trinidad_mssql_dbpool_extension 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,19 @@
1
+ == 0.5.0 (2013-06-28)
2
+
3
+ * updated tomcat-dbcp.jar to 7.0.41 ... due recent fixes in 7.0.39 / 7.0.40 :
4
+ - major statement leak https://issues.apache.org/bugzilla/show_bug.cgi?id=54732
5
+ * no longer bundling driver jars instead depending on jdbc-xxx gems :
6
+ - trinidad_mysql_dbpool_extension -> jdbc-mysql
7
+ - trinidad_postgresql_dbpool_extension - jdbc-postgres
8
+ - trinidad_sqlite_dbpool_extension - jdbc-sqlite3
9
+ - trinidad_mssql_dbpool_extension - jdbc-jtds
10
+
11
+ == 0.4.2 (2012-12-22)
12
+
13
+ * updated tomcat-dbcp.jar to 7.0.32
14
+ * support multiple jar files (and globbing) with driver path
15
+ * trinidad_mssql_dbpool_extension jTDS jar updated to 1.3.0
16
+
1
17
  == 0.4.1 (2012-11-29)
2
18
 
3
19
  * updated driver jars for following :
@@ -25,7 +41,7 @@
25
41
 
26
42
  == 0.2.0 (2010-07-29)
27
43
 
28
- * Update trinidad_dbpool_extension common gem to support Tomcat 7
44
+ * Update trinidad_dbpool_extension common gem to support Tomcat 7
29
45
 
30
46
  == 0.1.1 (2010-05-05)
31
47
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Team Trinidad and contributors http://github.com/trinidad
1
+ Copyright (c) 2013 Team Trinidad and contributors http://github.com/trinidad
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -21,5 +21,5 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  == JDBC Driver
23
23
 
24
- Included JDBC drivers are most likely distributed under different terms than
24
+ Included JDBC drivers are most likely distributed under different terms than
25
25
  those above, please make sure you understand your driver's license terms.
data/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # Trinidad Database Pool
2
+
3
+ A bunch of Trinidad extensions to support database connection pooling on top of
4
+ the underlying Apache Tomcat container (using Tomcat's JDBC Connection Pool).
5
+
6
+ Please note, that such pools are usually configured as "global" and thus
7
+ shareable by multiple applications deployed on to of the Trinidad server.
8
+
9
+ Also most Java issues caused by JDBC drivers packaged with the application (e.g.
10
+ `java.lang.UnsatisfiedLinkError` with SQLite3's JDBC driver) that JRuby inherits
11
+ should go away when database connections are managed externally.
12
+
13
+ http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html
14
+
15
+ ## Available Pools
16
+
17
+ * MySQL (trinidad_mysql_dbpool_extension)
18
+ * PostgreSQL (trinidad_postgresql_dbpool_extension)
19
+ * SQLite (trinidad_sqlite_dbpool_extension)
20
+ * MS-SQL (trinidad_mssql_dbpool_extension) using (unofficial) jTDS driver
21
+ * Generic (trinidad_generic_dbpool_extension) in case your DB ain't supported
22
+
23
+ ## Usage
24
+
25
+ * Install the gem e.g. `jruby -S gem install trinidad_mysql_dbpool_extension`
26
+ * Configure the pool with Trinidad's configuration file e.g. :
27
+
28
+ ```yml
29
+ web_apps:
30
+ default:
31
+ extensions:
32
+ mysql_dbpool: # EXTENSION NAME AS KEY
33
+ jndi: 'jdbc/TestDB' # name (linked with database.yml)
34
+ url: 'localhost:3306/javatest' # database URL (or full jdbc: URL)
35
+ username: 'root' # database username
36
+ password: 'root' # database password
37
+ maxActive: 100 # max nodes actives
38
+ maxIdle: 30 # max nodes idles
39
+ maxWait: 10000 # max nodes waiting
40
+ ```
41
+
42
+ **jndi**, **url** are mandatory (as well **username** and **password** if your
43
+ database server + driver requires authentication), while other supported
44
+ configuration options might be found here in Tomcat's "datasource" how-to:
45
+
46
+ http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html
47
+
48
+ http://commons.apache.org/dbcp/configuration.html
49
+
50
+ If you happen to be using *SQLite* on production you'll need an absolute path :
51
+
52
+ ```yml
53
+ extensions:
54
+ sqlite_dbpool:
55
+ jndi: jdbc/FileDB
56
+ url: <%= File.expand_path('db/production.db') %>
57
+ ```
58
+
59
+ * Configure the (Rails) application to use JNDI with *config/database.yml*
60
+
61
+ ```yml
62
+ production:
63
+ adapter: jdbc # it will detect the adapter spec e.g. `ArJdbc::MySQL`
64
+ jndi: java:/comp/env/jdbc/TestDB
65
+ # (Java) JDBC driver class name is detected for built-in adapters that
66
+ # activerecord-jdbc-adapter supports, specify for a "generic" adapter
67
+ #driver: com.mysql.jdbc.Driver
68
+ ```
69
+
70
+ do not forget to delete **pool** setup part since there's no need for it ...
71
+
72
+ ## Generic Pool
73
+
74
+ If there's no "official" pool for your database, or would like to use a
75
+ different version of a JDBC driver for a supported Trinidad pool, this allows
76
+ you to completely customize a pool.
77
+
78
+ NOTE: You will need a JDBC driver for your database, check the driver DB if
79
+ unsure about how to get one http://developers.sun.com/product/jdbc/drivers
80
+
81
+ Sample configuration for a DB2 database :
82
+
83
+ ```yml
84
+ ---
85
+ extensions:
86
+ generic_dbpool: # EXTENSION NAME AS KEY
87
+ jndi: 'jdbc/MyDB' # JNDI name
88
+ url: 'jdbc:db2://127.0.0.1:50000/MYDB' # specify full jdbc: URL
89
+ username: 'mydb' # database username
90
+ password: 'pass' # database password
91
+ driverPath: '/opt/IBM/DB2/db2jcc4.jar' # leave out if on class-path
92
+ driverName: com.ibm.db2.jcc.DB2Driver # resolved from driverPath jar
93
+ ```
94
+
95
+ Beyond standard configuration options there's 2 specific options here :
96
+
97
+ * **driverPath** should be a path to your JDBC driver archive, might leave that
98
+ out but make sure it's on the (shared) class-path for each and every deployed
99
+ application that requires it. You might specify multiple jars using the
100
+ `Dir.glob` syntax or by separating paths using the `:` separator.
101
+
102
+ Also in case *driverPath* is omitted you'll need to specify a *driverName* !
103
+
104
+ * **driverName** the class name implementing the JDBC driver interface, if
105
+ you're not sure check the .jar for a META-INF/services/java.sql.Driver file.
106
+ If present that file contains the class-name and you might leave *driverName*
107
+ blank if you specified the jar path using *driverPath* but you're going still
108
+ going to need the driver name in your *database.yml*
109
+
110
+ ## Copyright
111
+
112
+ Copyright (c) 2013 [Team Trinidad](https://github.com/trinidad).
113
+ See LICENSE (http://en.wikipedia.org/wiki/MIT_License) for details.
@@ -1,3 +1,2 @@
1
1
  require 'trinidad_dbpool'
2
- load File.expand_path('../../trinidad-libs/jtds-1.3.0.jar', __FILE__)
3
- require 'trinidad_mssql_dbpool_extension/mssql_webapp_extension'
2
+ require 'trinidad_mssql_dbpool_extension/mssql_webapp_extension'
@@ -1,13 +1,23 @@
1
1
  module Trinidad
2
2
  module Extensions
3
3
  class MssqlDbpoolWebAppExtension < DbpoolWebAppExtension
4
+
4
5
  def driver_name
5
- 'net.sourceforge.jtds.jdbc.Driver'
6
+ defined?(Jdbc::JTDS.driver_name) ? Jdbc::JTDS.driver_name :
7
+ 'net.sourceforge.jtds.jdbc.Driver'
6
8
  end
7
9
 
8
10
  def protocol
9
11
  'jdbc:jtds:sqlserver://'
10
12
  end
13
+
14
+ def load_driver
15
+ require 'jdbc/jtds'
16
+ # NOTE: the adapter has only support for working with the
17
+ # open-source jTDS driver (won't work with MS's driver) !
18
+ Jdbc::JTDS.load_driver if defined?(Jdbc::JTDS.load_driver)
19
+ end
20
+
11
21
  end
12
22
  end
13
- end
23
+ end
metadata CHANGED
@@ -1,93 +1,122 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: trinidad_mssql_dbpool_extension
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.4.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ prerelease:
6
6
  platform: ruby
7
- authors:
8
- - Brian Tatnall
9
- autorequire:
7
+ authors:
8
+ - Brian Tatnall
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-12-04 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: trinidad_dbpool
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 0.4.0
24
- type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: rspec
28
- prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "2.10"
35
- type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: mocha
39
- prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: "0.10"
46
- type: :development
47
- version_requirements: *id003
12
+ date: 2013-06-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: trinidad_dbpool
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: 0.5.0
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.5.0
27
+ none: false
28
+ prerelease: false
29
+ type: :runtime
30
+ - !ruby/object:Gem::Dependency
31
+ name: jdbc-jtds
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - '>='
35
+ - !ruby/object:Gem::Version
36
+ version: 1.2.7
37
+ none: false
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: 1.2.7
43
+ none: false
44
+ prerelease: false
45
+ type: :runtime
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '2.10'
53
+ none: false
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '2.10'
59
+ none: false
60
+ prerelease: false
61
+ type: :development
62
+ - !ruby/object:Gem::Dependency
63
+ name: mocha
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0.10'
69
+ none: false
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0.10'
75
+ none: false
76
+ prerelease: false
77
+ type: :development
48
78
  description: Addon to support MS SQL Server database pools in Trinidad
49
79
  email: btatnall@gmail.com
50
80
  executables: []
51
-
52
81
  extensions: []
53
-
54
- extra_rdoc_files:
55
- - LICENSE
56
- - README.rdoc
57
- files:
58
- - lib/trinidad_mssql_dbpool_extension.rb
59
- - lib/trinidad_mssql_dbpool_extension/mssql_webapp_extension.rb
60
- - trinidad-libs/jtds-1.3.0.jar
61
- - History.txt
62
- - LICENSE
63
- - README.rdoc
64
- - Rakefile
82
+ extra_rdoc_files:
83
+ - README.md
84
+ - History.txt
85
+ - LICENSE
86
+ files:
87
+ - lib/trinidad_mssql_dbpool_extension.rb
88
+ - lib/trinidad_mssql_dbpool_extension/mssql_webapp_extension.rb
89
+ - README.md
90
+ - History.txt
91
+ - LICENSE
65
92
  homepage: http://github.com/trinidad/trinidad_dbpool_extension
66
93
  licenses: []
67
-
68
- post_install_message:
94
+ post_install_message:
69
95
  rdoc_options: []
70
-
71
- require_paths:
72
- - lib
73
- required_ruby_version: !ruby/object:Gem::Requirement
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ segments:
103
+ - 0
104
+ version: '0'
105
+ hash: 2
74
106
  none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: "0"
79
- required_rubygems_version: !ruby/object:Gem::Requirement
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ segments:
112
+ - 0
113
+ version: '0'
114
+ hash: 2
80
115
  none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- version: "0"
85
116
  requirements: []
86
-
87
- rubyforge_project:
117
+ rubyforge_project:
88
118
  rubygems_version: 1.8.24
89
- signing_key:
119
+ signing_key:
90
120
  specification_version: 3
91
121
  summary: Addon to support MS SQL Server database pools in Trinidad
92
122
  test_files: []
93
-
data/README.rdoc DELETED
@@ -1,94 +0,0 @@
1
- = trinidad-dbpool
2
-
3
- Trinidad extensions to support database connection pooling on top of the
4
- underlying Apache Tomcat container.
5
-
6
- Please note, that such pools are usually configured as "global" and thus
7
- shareable by multiple applications deployed on to of Trinidad server.
8
-
9
- == Available Pools
10
-
11
- * MySQL (trinidad_mysql_dbpool_extension)
12
- * PostgreSQL (trinidad_postgresql_dbpool_extension)
13
- * MS-SQL (trinidad_mssql_dbpool_extension) using (unofficial) jTDS driver
14
- * Oracle (trinidad_oracle_dbpool_extension)
15
- * Generic (trinidad_generic_dbpool_extension) in case your DB ain't supported
16
-
17
- == Usage
18
-
19
- * Install the gem e.g. `jruby -S gem install trinidad_mysql_dbpool_extension`
20
- * Configure the pool with Trinidad's configuration file e.g. :
21
-
22
- web_apps:
23
- default:
24
- extensions:
25
- mysql_dbpool: # EXTENSION NAME AS KEY
26
- jndi: 'jdbc/TestDB' # JNDI name
27
- username: 'root' # database username
28
- password: 'root' # database password
29
- url: 'localhost:3306/javatest' # database URL (or full jdbc: URL)
30
- maxActive: 100 # max nodes actives
31
- maxIdle: 30 # max nodes idles
32
- maxWait: 10000 # max nodes waiting
33
-
34
- _jndi_, _username_, _password_ and _url_ are mandatory,
35
- while other supported configuration options might be found here:
36
-
37
- http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
38
-
39
- http://commons.apache.org/dbcp/configuration.html
40
-
41
- * Configure your rails application to use JNDI into the config/database.yml
42
-
43
- production:
44
- adapter: jdbc
45
- jndi: java:/comp/env/jdbc/TestDB
46
- driver: com.mysql.jdbc.Driver # JDBC driver is mandatory here
47
-
48
- == Generic Pool
49
-
50
- If there's no "official" pool for your database, or would like to use a
51
- different version of a JDBC driver for a supported Trinidad pool, this allows
52
- you to completely customize a pool.
53
-
54
- NOTE: You will need a JDBC driver for your database, check the driver DB if
55
- unsure about how to get one http://developers.sun.com/product/jdbc/drivers
56
-
57
- Sample configuration for a DB2 database :
58
-
59
- ---
60
- extensions:
61
- generic_dbpool: # EXTENSION NAME AS KEY
62
- jndi: 'jdbc/MyDB' # JNDI name
63
- url: 'jdbc:db2://127.0.0.1:50000/MYDB' # specify full jdbc: URL
64
- username: 'mydb' # database username
65
- password: 'pass' # database password
66
- driverPath: '/opt/IBM/DB2/db2jcc4.jar' # leave out if it's on class-path
67
- driverName: com.ibm.db2.jcc.DB2Driver # might resolve from driverPath
68
-
69
- Beyond standard configuration options there's 2 specific options here :
70
-
71
- * _driverPath_ should be a path to your JDBC driver archive, if you're using a
72
- --libs jar folder with trinidad, might leave that out but make sure it's on
73
- the class-path for each and every deployed application that requires it.
74
-
75
- Also in case driverPath: is ommited you'll need to specify a driverName: !
76
-
77
- * _driverName_ the class name implementing the JDBC driver interface, if you're
78
- not sure check the .jar for a META-INF/services/java.sql.Driver file. If
79
- present that file contains the class-name and you might leave driverName:
80
- blank if you specified the jar path using driverPath: but you're going still
81
- going to need the driver name in your database.yml
82
-
83
- == Note on Patches/Pull Requests
84
-
85
- * Fork the project.
86
- * Make your feature addition or bug fix.
87
- * Add tests for it. This is important so I don't break it in a
88
- future version unintentionally.
89
- * Send me a pull request. Bonus points for topic branches.
90
-
91
- == Copyright
92
-
93
- Copyright (c) 2012 [Team Trinidad](https://github.com/trinidad).
94
- See LICENSE (http://en.wikipedia.org/wiki/MIT_License) for details.
data/Rakefile DELETED
@@ -1,76 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- def build(gem)
5
- mkdir_p 'pkg'
6
- sh "gem build #{gem}.gemspec"
7
- mv Dir["#{gem}*.gem"].last, 'pkg'
8
- end
9
-
10
- def release(gem, version = nil)
11
- unless `git branch` =~ /^\* master$/
12
- raise "must be on master to release !"
13
- end
14
-
15
- if version
16
- unless gem_file = Dir.glob("pkg/#{gem}-#{version}.gem").first
17
- raise "#{gem}-#{version}.gem not build !"
18
- end
19
- else
20
- unless gem_file = Dir.glob("pkg/#{gem}*").sort.last
21
- raise "#{gem}*.gem not build !"
22
- end
23
- unless match = gem_file.match(/.*?\-(\d\.\d\.\d)\.gem/)
24
- raise "version number not matched from: #{gem_file}"
25
- end
26
- version = match[1]
27
- end
28
-
29
- sh "git tag #{gem}-#{version}"
30
- sh "git push origin master --tags"
31
- sh "gem push #{gem_file}"
32
- end
33
-
34
- all_gems = %W{
35
- dbpool
36
- generic_dbpool_extension
37
- mysql_dbpool_extension
38
- postgresql_dbpool_extension
39
- sqlite_dbpool_extension
40
- mssql_dbpool_extension
41
- oracle_dbpool_extension
42
- }
43
- all_gems.map! { |gem| "trinidad_#{gem}" }
44
- all_gems.each do |gem_name|
45
- namespace gem_name do
46
- desc "Build the #{gem_name} gem"
47
- task :build do
48
- build(gem_name)
49
- end
50
- desc "Release the #{gem_name} gem"
51
- task :release => :build do
52
- release(gem_name)
53
- end
54
- end
55
- end
56
-
57
- {
58
- :build => 'Build all connection pool gems',
59
- :release => 'Release all connection pool gems'
60
- }.each do |t, d|
61
- desc d
62
- task t => all_gems.map { |name| "#{name}:#{t}" } # e.g. mysql_dbpool:build
63
- end
64
-
65
- desc "Clear out all built .gem files"
66
- task :clear do
67
- FileUtils.rm Dir["*.gem"]
68
- FileUtils.rm_r Dir["pkg/*"] if File.exist?("pkg")
69
- end
70
-
71
- require 'rspec/core/rake_task'
72
- RSpec::Core::RakeTask.new(:spec) do |spec|
73
- spec.rspec_opts = ['--color', "--format documentation"]
74
- end
75
-
76
- task :default => :spec
Binary file