activerecord-jdbc-alt-adapter 52.4.0-java → 61.0.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.nvimlog +0 -0
- data/.travis.yml +63 -39
- data/Gemfile +11 -4
- data/README.md +55 -35
- data/Rakefile +1 -1
- data/Rakefile.jdbc +8 -1
- data/activerecord-jdbc-adapter.gemspec +6 -9
- data/activerecord-jdbc-alt-adapter.gemspec +9 -12
- data/lib/arel/visitors/postgresql_jdbc.rb +1 -1
- data/lib/arel/visitors/sqlserver.rb +49 -23
- data/lib/arjdbc/abstract/connection_management.rb +7 -0
- data/lib/arjdbc/abstract/core.rb +17 -23
- data/lib/arjdbc/abstract/database_statements.rb +30 -2
- data/lib/arjdbc/abstract/statement_cache.rb +2 -5
- data/lib/arjdbc/abstract/transaction_support.rb +22 -7
- data/lib/arjdbc/db2/column.rb +0 -39
- data/lib/arjdbc/derby/adapter.rb +1 -20
- data/lib/arjdbc/firebird/adapter.rb +0 -21
- data/lib/arjdbc/h2/adapter.rb +0 -15
- data/lib/arjdbc/hsqldb/adapter.rb +0 -14
- data/lib/arjdbc/informix/adapter.rb +0 -23
- data/lib/arjdbc/jdbc/adapter.rb +3 -1
- data/lib/arjdbc/jdbc/adapter_require.rb +3 -1
- data/lib/arjdbc/jdbc/base_ext.rb +3 -1
- data/lib/arjdbc/jdbc/callbacks.rb +2 -0
- data/lib/arjdbc/jdbc/column.rb +2 -0
- data/lib/arjdbc/jdbc/connection.rb +2 -0
- data/lib/arjdbc/jdbc/connection_methods.rb +2 -0
- data/lib/arjdbc/jdbc/error.rb +2 -0
- data/lib/arjdbc/jdbc/extension.rb +2 -0
- data/lib/arjdbc/jdbc/java.rb +3 -1
- data/lib/arjdbc/jdbc/railtie.rb +3 -1
- data/lib/arjdbc/jdbc/rake_tasks.rb +3 -1
- data/lib/arjdbc/jdbc/serialized_attributes_helper.rb +3 -1
- data/lib/arjdbc/jdbc/type_cast.rb +2 -0
- data/lib/arjdbc/jdbc/type_converter.rb +2 -0
- data/lib/arjdbc/mssql.rb +3 -1
- data/lib/arjdbc/mssql/adapter.rb +114 -36
- data/lib/arjdbc/mssql/column.rb +19 -1
- data/lib/arjdbc/mssql/connection_methods.rb +10 -2
- data/lib/arjdbc/mssql/database_limits.rb +9 -0
- data/lib/arjdbc/mssql/database_statements.rb +44 -6
- data/lib/arjdbc/mssql/errors.rb +2 -0
- data/lib/arjdbc/mssql/explain_support.rb +3 -1
- data/lib/arjdbc/mssql/extensions/attribute_methods.rb +6 -2
- data/lib/arjdbc/mssql/extensions/calculations.rb +2 -0
- data/lib/arjdbc/mssql/quoting.rb +38 -0
- data/lib/arjdbc/mssql/schema_creation.rb +25 -3
- data/lib/arjdbc/mssql/schema_definitions.rb +10 -0
- data/lib/arjdbc/mssql/schema_dumper.rb +2 -0
- data/lib/arjdbc/mssql/schema_statements.rb +92 -22
- data/lib/arjdbc/mssql/transaction.rb +2 -0
- data/lib/arjdbc/mssql/types.rb +2 -0
- data/lib/arjdbc/mssql/types/binary_types.rb +2 -0
- data/lib/arjdbc/mssql/types/date_and_time_types.rb +2 -0
- data/lib/arjdbc/mssql/types/deprecated_types.rb +2 -0
- data/lib/arjdbc/mssql/types/numeric_types.rb +2 -0
- data/lib/arjdbc/mssql/types/string_types.rb +2 -0
- data/lib/arjdbc/mssql/utils.rb +2 -0
- data/lib/arjdbc/mysql/adapter.rb +59 -21
- data/lib/arjdbc/mysql/connection_methods.rb +6 -1
- data/lib/arjdbc/postgresql/adapter.rb +257 -219
- data/lib/arjdbc/postgresql/base/array_decoder.rb +2 -0
- data/lib/arjdbc/postgresql/base/array_encoder.rb +4 -2
- data/lib/arjdbc/postgresql/base/array_parser.rb +4 -2
- data/lib/arjdbc/postgresql/base/pgconn.rb +2 -0
- data/lib/arjdbc/postgresql/column.rb +6 -4
- data/lib/arjdbc/postgresql/connection_methods.rb +1 -0
- data/lib/arjdbc/postgresql/name.rb +2 -0
- data/lib/arjdbc/postgresql/oid_types.rb +7 -4
- data/lib/arjdbc/sqlite3/adapter.rb +266 -221
- data/lib/arjdbc/sqlite3/connection_methods.rb +26 -4
- data/lib/arjdbc/tasks/databases.rake +21 -13
- data/lib/arjdbc/tasks/mssql_database_tasks.rb +126 -25
- data/lib/arjdbc/util/quoted_cache.rb +3 -1
- data/lib/arjdbc/util/serialized_attributes.rb +3 -1
- data/lib/arjdbc/util/table_copier.rb +3 -1
- data/lib/arjdbc/version.rb +3 -1
- data/pom.xml +4 -4
- data/rakelib/01-tomcat.rake +2 -2
- data/rakelib/rails.rake +1 -1
- data/src/java/arjdbc/ArJdbcModule.java +5 -5
- data/src/java/arjdbc/jdbc/DriverWrapper.java +1 -9
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +549 -691
- data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +88 -0
- data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +13 -23
- data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +125 -53
- data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +97 -103
- data/src/java/arjdbc/util/DateTimeUtils.java +12 -4
- metadata +10 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd61f85687802bf7bad5e3013413ccbda73395044d46775e8fa5f6d57e8410ca
|
|
4
|
+
data.tar.gz: 245c8e59a5bbf3e87e7f9f0759070dda617801ce650bdb089cb1c16daa4119eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f11b067072016b63fa265435c90d45672463cc80e5ac1e8199bc96d209704affdc30a75d89a6ac5fb67ea5fad06c91c7ef59af87651e387beb360e64dc027e32
|
|
7
|
+
data.tar.gz: b1e71248871946ccaa981bb0a74f08fdeba605637b020f704ae0197dad96c00947cfe0f87752f010499d6ddad9a6a97ffe7791cb6f7a0dd69e4f57f2d7643014
|
data/.gitignore
CHANGED
data/.nvimlog
ADDED
|
File without changes
|
data/.travis.yml
CHANGED
|
@@ -3,8 +3,6 @@ dist: xenial
|
|
|
3
3
|
|
|
4
4
|
services:
|
|
5
5
|
- mysql
|
|
6
|
-
addons:
|
|
7
|
-
postgresql: 9.4
|
|
8
6
|
|
|
9
7
|
before_install:
|
|
10
8
|
- unset _JAVA_OPTIONS
|
|
@@ -17,7 +15,7 @@ install:
|
|
|
17
15
|
|
|
18
16
|
language: ruby
|
|
19
17
|
rvm:
|
|
20
|
-
- jruby-9.
|
|
18
|
+
- jruby-9.2.14.0
|
|
21
19
|
jdk:
|
|
22
20
|
- openjdk8
|
|
23
21
|
|
|
@@ -39,8 +37,8 @@ before_script:
|
|
|
39
37
|
mysql -e "grant all privileges on activerecord_unittest.* to rails@localhost;" && \
|
|
40
38
|
mysql -e "grant all privileges on activerecord_unittest2.* to rails@localhost;" && \
|
|
41
39
|
mysql -e "grant all privileges on inexistent_activerecord_unittest.* to rails@localhost;" && \
|
|
42
|
-
mysql -e "CREATE DATABASE activerecord_unittest DEFAULT CHARACTER SET
|
|
43
|
-
mysql -e "CREATE DATABASE activerecord_unittest2 DEFAULT CHARACTER SET
|
|
40
|
+
mysql -e "CREATE DATABASE activerecord_unittest DEFAULT CHARACTER SET utf8mb4;" && \
|
|
41
|
+
mysql -e "CREATE DATABASE activerecord_unittest2 DEFAULT CHARACTER SET utf8mb4;" \
|
|
44
42
|
|| true
|
|
45
43
|
- |
|
|
46
44
|
[ "$DB" == "postgresql" ] && [ "$TEST_PREFIX" == "rails:" ] && \
|
|
@@ -49,45 +47,61 @@ before_script:
|
|
|
49
47
|
|| true
|
|
50
48
|
|
|
51
49
|
env:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
- DB=mysql2 DRIVER=MariaDB
|
|
55
|
-
- DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=false
|
|
56
|
-
- DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=true
|
|
57
|
-
- DB=postgresql PREPARED_STATEMENTS=true
|
|
58
|
-
- DB=postgresql PREPARED_STATEMENTS=true INSERT_RETURNING=true
|
|
59
|
-
- DB=sqlite3 PREPARED_STATEMENTS=false
|
|
60
|
-
- DB=sqlite3 PREPARED_STATEMENTS=true
|
|
61
|
-
- DB=jndi PREPARED_STATEMENTS=false
|
|
62
|
-
- DB=jndi PREPARED_STATEMENTS=true
|
|
50
|
+
global:
|
|
51
|
+
- AR_VERSION="master"
|
|
63
52
|
matrix:
|
|
64
53
|
allow_failures:
|
|
65
54
|
- rvm: jruby-head
|
|
66
55
|
include:
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
env: DB=
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
env: DB=
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
env: DB=postgresql
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
env: DB=
|
|
83
|
-
|
|
56
|
+
- env: DB=mysql2 PREPARED_STATEMENTS=false
|
|
57
|
+
- env: DB=mysql2 PREPARED_STATEMENTS=true
|
|
58
|
+
- env: DB=mysql2 DRIVER=MariaDB
|
|
59
|
+
|
|
60
|
+
- addons:
|
|
61
|
+
postgresql: "10"
|
|
62
|
+
env: DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=false
|
|
63
|
+
- addons:
|
|
64
|
+
postgresql: "10"
|
|
65
|
+
env: DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=true
|
|
66
|
+
- addons:
|
|
67
|
+
postgresql: "10"
|
|
68
|
+
env: DB=postgresql PREPARED_STATEMENTS=true
|
|
69
|
+
- addons:
|
|
70
|
+
postgresql: "10"
|
|
71
|
+
env: DB=postgresql PREPARED_STATEMENTS=true INSERT_RETURNING=true
|
|
72
|
+
- addons:
|
|
73
|
+
postgresql: "10"
|
|
74
|
+
env: DB=postgresql PREPARED_STATEMENTS=true JRUBY_OPTS=-J-Duser.timezone=America/Detroit
|
|
75
|
+
- addons:
|
|
76
|
+
postgresql: "9.4"
|
|
77
|
+
env: DB=postgresql PREPARED_STATEMENTS=true
|
|
78
|
+
|
|
79
|
+
- env: DB=sqlite3 PREPARED_STATEMENTS=false
|
|
80
|
+
- env: DB=sqlite3 PREPARED_STATEMENTS=true
|
|
81
|
+
|
|
82
|
+
- env: DB=jndi PREPARED_STATEMENTS=false
|
|
83
|
+
- env: DB=jndi PREPARED_STATEMENTS=true
|
|
84
|
+
|
|
85
|
+
# Java 11
|
|
86
|
+
- env: DB=mysql2
|
|
87
|
+
jdk: oraclejdk11
|
|
88
|
+
- env: DB=postgresql
|
|
89
|
+
jdk: oraclejdk11
|
|
90
|
+
addons:
|
|
91
|
+
postgresql: "10"
|
|
92
|
+
- env: DB=sqlite3
|
|
93
|
+
jdk: oraclejdk11
|
|
94
|
+
|
|
84
95
|
# jruby-head
|
|
85
96
|
- rvm: jruby-head
|
|
86
97
|
env: DB=mysql2
|
|
87
98
|
- rvm: jruby-head
|
|
88
99
|
env: DB=postgresql
|
|
100
|
+
addons:
|
|
101
|
+
postgresql: "10"
|
|
89
102
|
- rvm: jruby-head
|
|
90
103
|
env: DB=sqlite3
|
|
104
|
+
|
|
91
105
|
# testing against MariaDB
|
|
92
106
|
- addons:
|
|
93
107
|
mariadb: 10.2
|
|
@@ -95,10 +109,20 @@ matrix:
|
|
|
95
109
|
- addons:
|
|
96
110
|
mariadb: 10.3
|
|
97
111
|
env: DB=mariadb PREPARED_STATEMENTS=true
|
|
112
|
+
|
|
98
113
|
# Rails test-suite :
|
|
99
|
-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="
|
|
100
|
-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="
|
|
101
|
-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
|
|
114
|
+
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-1-stable" # PS off by default
|
|
115
|
+
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-1-stable" PREPARED_STATEMENTS=true
|
|
116
|
+
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-1-stable" DRIVER=MariaDB
|
|
117
|
+
|
|
118
|
+
- addons:
|
|
119
|
+
postgresql: "10"
|
|
120
|
+
env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-1-stable" # PS on by default
|
|
121
|
+
- addons:
|
|
122
|
+
postgresql: "10"
|
|
123
|
+
env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-1-stable" PREPARED_STATEMENTS=false
|
|
124
|
+
- addons:
|
|
125
|
+
postgresql: "9.4"
|
|
126
|
+
env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-1-stable" # PS on by default
|
|
127
|
+
|
|
128
|
+
- env: DB=sqlite3 TEST_PREFIX="rails:" AR_VERSION="6-1-stable"
|
data/Gemfile
CHANGED
|
@@ -10,10 +10,15 @@ if ENV['RAILS'] # Use local clone of Rails
|
|
|
10
10
|
|
|
11
11
|
activemodel_dir = ::File.join(rails_dir, 'activemodel')
|
|
12
12
|
activesupport_dir = ::File.join(rails_dir, 'activesupport')
|
|
13
|
-
|
|
13
|
+
actionpack_dir = ::File.join(rails_dir, 'actionpack')
|
|
14
|
+
actionview_dir = ::File.join(rails_dir, 'actionview')
|
|
15
|
+
|
|
14
16
|
gem 'activerecord', require: false, path: activerecord_dir
|
|
15
17
|
gem 'activemodel', require: false, path: activemodel_dir
|
|
16
18
|
gem 'activesupport', require: false, path: activesupport_dir
|
|
19
|
+
gem 'actionpack', require: false, path: actionpack_dir
|
|
20
|
+
gem 'actionview', require: false, path: actionview_dir
|
|
21
|
+
|
|
17
22
|
elsif ENV['AR_VERSION'] # Use specific version of AR and not .gemspec version
|
|
18
23
|
version = ENV['AR_VERSION']
|
|
19
24
|
|
|
@@ -28,11 +33,13 @@ elsif ENV['AR_VERSION'] # Use specific version of AR and not .gemspec version
|
|
|
28
33
|
else # branch
|
|
29
34
|
opts = {branch: version}
|
|
30
35
|
end
|
|
31
|
-
|
|
36
|
+
|
|
32
37
|
git 'https://github.com/rails/rails.git', **opts do
|
|
33
38
|
gem 'activerecord', require: false
|
|
34
39
|
gem 'activemodel', require: false
|
|
35
40
|
gem 'activesupport', require: false
|
|
41
|
+
gem 'actionpack', require: false
|
|
42
|
+
gem 'actionview', require: false
|
|
36
43
|
end
|
|
37
44
|
end
|
|
38
45
|
end
|
|
@@ -48,13 +55,13 @@ group :test do
|
|
|
48
55
|
gem 'mocha', '~> 1.2', require: false # Rails has '~> 0.14'
|
|
49
56
|
|
|
50
57
|
gem 'bcrypt', '~> 3.1.11', require: false
|
|
51
|
-
gem 'jdbc-mssql', '~> 0.
|
|
58
|
+
gem 'jdbc-mssql', '~> 0.9.0', require: nil
|
|
52
59
|
# gem 'pry-debugger-jruby', platform: :jruby
|
|
53
60
|
end
|
|
54
61
|
|
|
55
62
|
group :rails do
|
|
56
63
|
group :test do
|
|
57
|
-
gem 'minitest', '~> 5.
|
|
64
|
+
gem 'minitest', '~> 5.12.2', require: nil
|
|
58
65
|
gem 'minitest-excludes', '~> 2.0.1', require: nil
|
|
59
66
|
gem 'minitest-rg', require: nil
|
|
60
67
|
|
data/README.md
CHANGED
|
@@ -2,20 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
This adapter is a fork of the ActiveRecord JDBC Adapter with basic support for
|
|
4
4
|
**SQL Server/Azure SQL**. This adapter may work with other databases
|
|
5
|
-
supported by the original adapter such as
|
|
6
|
-
use the [original adapter](https://github.com/jruby/
|
|
5
|
+
supported by the original adapter such as MySQL but it is advised to
|
|
6
|
+
use the [original adapter](https://github.com/jruby/activerecord-jdbc-adapter)
|
|
7
7
|
|
|
8
8
|
This adapter only works with JRuby and it is advised to install the latest
|
|
9
|
-
stable
|
|
9
|
+
stable of this adapter and Rails
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
| Gem Version | Rails Version | min JRuby |
|
|
12
|
+
| ----------- | ------------- | --------- |
|
|
13
|
+
| 50.7.0 | 5.0.7 | 9.1.x |
|
|
14
|
+
| 51.7.0 | 5.1.7 | 9.1.x |
|
|
15
|
+
| 52.6.0 | 5.2.4 | 9.1.x |
|
|
16
|
+
| 60.1.0 | 6.0.3 | 9.2.9 |
|
|
17
|
+
| 61.0.0 | 6.1.3 | 9.2.16 |
|
|
16
18
|
|
|
17
19
|
This adapter passes most of the Rails tests (ActiveRecord tests) with the
|
|
18
|
-
exception of some test that are not compatible with the SQL Server
|
|
20
|
+
exception of some test that are not compatible with the SQL Server. To run
|
|
21
|
+
the test use the following fork [Rails](https://github.com/JesseChavez/rails/tree/6-1-stable-dev),
|
|
22
|
+
and the instructions in file `RUNNING_TESTS.md`. The fork has some
|
|
23
|
+
schema tweaks to make it compatible with SQL Server.
|
|
19
24
|
|
|
20
25
|
### How to use it:
|
|
21
26
|
|
|
@@ -24,13 +29,19 @@ Add the following to your `Gemfile`:
|
|
|
24
29
|
```ruby
|
|
25
30
|
platforms :jruby do
|
|
26
31
|
# Use jdbc as the database for Active Record
|
|
27
|
-
gem 'activerecord-jdbc-alt-adapter', '~>
|
|
28
|
-
gem 'jdbc-mssql', '~> 0.
|
|
32
|
+
gem 'activerecord-jdbc-alt-adapter', '~> 61.0.0'
|
|
33
|
+
gem 'jdbc-mssql', '~> 0.9.0'
|
|
29
34
|
end
|
|
30
35
|
```
|
|
31
36
|
|
|
32
|
-
Or look at the sample rails
|
|
33
|
-
|
|
37
|
+
Or look at the sample rails and see how is set up:
|
|
38
|
+
|
|
39
|
+
- Rails 6.1 sample app [wombat61](https://github.com/JesseChavez/wombat61)
|
|
40
|
+
|
|
41
|
+
- Rails 6.0 sample app [wombat60](https://github.com/JesseChavez/wombat60)
|
|
42
|
+
|
|
43
|
+
- Rails 5.0 sample app [wombat50](https://github.com/JesseChavez/wombat50)
|
|
44
|
+
|
|
34
45
|
|
|
35
46
|
### Breaking changes
|
|
36
47
|
|
|
@@ -102,14 +113,6 @@ production:
|
|
|
102
113
|
```
|
|
103
114
|
|
|
104
115
|
|
|
105
|
-
### NOTE
|
|
106
|
-
|
|
107
|
-
Keep one eye in the Rails connection pool, we have not thoroughly tested that
|
|
108
|
-
part since we don't use the default Rails connection pool, other than that
|
|
109
|
-
this adapter should just work.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
116
|
# ActiveRecord JDBC Adapter
|
|
114
117
|
|
|
115
118
|
[][7]
|
|
@@ -130,15 +133,16 @@ is not something we can do with the resources we currently have.
|
|
|
130
133
|
|
|
131
134
|
Versions are targeted at certain versions of Rails and live on their own branches.
|
|
132
135
|
|
|
133
|
-
| Gem Version | Rails Version | Branch |
|
|
134
|
-
| ----------- | ------------- |
|
|
135
|
-
| 50.x | 5.0.x | 50-stable |
|
|
136
|
-
| 51.x | 5.1.x | 51-stable |
|
|
137
|
-
| 52.x | 5.2.x | 52-stable |
|
|
138
|
-
|
|
|
136
|
+
| Gem Version | Rails Version | Branch | min JRuby | min Java |
|
|
137
|
+
| ----------- | ------------- | --------- | --------- | -------- |
|
|
138
|
+
| 50.x | 5.0.x | 50-stable | 9.1.x | 7 |
|
|
139
|
+
| 51.x | 5.1.x | 51-stable | 9.1.x | 7 |
|
|
140
|
+
| 52.x | 5.2.x | 52-stable | 9.1.x | 7 |
|
|
141
|
+
| 60.x | 6.0.x | 60-stable | 9.2.7 | 8 |
|
|
142
|
+
| 61.x | 6.1.x | master | 9.2.7 | 8 |
|
|
139
143
|
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
Note that JRuby 9.1.x is end-of-life. We recommend Java 8 at a minimum for all
|
|
145
|
+
versions.
|
|
142
146
|
|
|
143
147
|
## Using ActiveRecord JDBC
|
|
144
148
|
|
|
@@ -195,6 +199,21 @@ production:
|
|
|
195
199
|
connectTimeout: 60000
|
|
196
200
|
```
|
|
197
201
|
|
|
202
|
+
#### MySQL specific notes
|
|
203
|
+
|
|
204
|
+
Depending on the MySQL server configuration, it might be required to set
|
|
205
|
+
additional connection properties for date/time support to work correctly. If you
|
|
206
|
+
encounter problems, try adding this to your database configuration:
|
|
207
|
+
|
|
208
|
+
```yml
|
|
209
|
+
properties:
|
|
210
|
+
serverTimezone: <%= java.util.TimeZone.getDefault.getID %>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
The correct timezone depends on the system setup, but the one shown is a good
|
|
214
|
+
place to start and is actually the correct setting for many systems.
|
|
215
|
+
|
|
216
|
+
|
|
198
217
|
### Standalone with ActiveRecord
|
|
199
218
|
|
|
200
219
|
Once the setup is made (see below) you can establish a JDBC connection like this
|
|
@@ -213,8 +232,8 @@ Proceed as with Rails; specify `ActiveRecord` in your Bundle along with the
|
|
|
213
232
|
chosen JDBC adapter(s), this time sample *Gemfile* for MySQL:
|
|
214
233
|
|
|
215
234
|
```ruby
|
|
216
|
-
gem 'activerecord', '~>
|
|
217
|
-
gem 'activerecord-jdbcmysql-adapter', :platform => :jruby
|
|
235
|
+
gem 'activerecord', '~> 6.0.3'
|
|
236
|
+
gem 'activerecord-jdbcmysql-adapter', '~> 60.2', :platform => :jruby
|
|
218
237
|
```
|
|
219
238
|
|
|
220
239
|
When you `require 'bundler/setup'` everything will be set up for you as expected.
|
|
@@ -223,13 +242,13 @@ When you `require 'bundler/setup'` everything will be set up for you as expected
|
|
|
223
242
|
|
|
224
243
|
Install the needed gems with JRuby, for example:
|
|
225
244
|
|
|
226
|
-
gem install activerecord -v "~>
|
|
227
|
-
gem install activerecord-jdbc-adapter --ignore-dependencies
|
|
245
|
+
gem install activerecord -v "~> 6.0.3"
|
|
246
|
+
gem install activerecord-jdbc-adapter -v "~> 60.2" --ignore-dependencies
|
|
228
247
|
|
|
229
248
|
If you wish to use the adapter for a specific database, you can install it
|
|
230
249
|
directly and the (jdbc-) driver gem (dependency) will be installed as well:
|
|
231
250
|
|
|
232
|
-
jruby -S gem install activerecord-jdbcmysql-adapter
|
|
251
|
+
jruby -S gem install activerecord-jdbcmysql-adapter -v "~> 60.2"
|
|
233
252
|
|
|
234
253
|
Your program should include:
|
|
235
254
|
|
|
@@ -269,7 +288,8 @@ ask on the #JRuby IRC channel on http://freenode.net/ (try [web-chat][6]).
|
|
|
269
288
|
This project was originally written by [Nick Sieger](http://github.com/nicksieger)
|
|
270
289
|
and [Ola Bini](http://github.com/olabini) with lots of help from the JRuby community.
|
|
271
290
|
Polished 3.x compatibility and 4.x support (for AR-JDBC >= 1.3.0) was managed by
|
|
272
|
-
[Karol Bucek](http://github.com/kares) among others.
|
|
291
|
+
[Karol Bucek](http://github.com/kares) among others. Support for Rails 6.0 and 6.1 was
|
|
292
|
+
contributed by [shellyBits GmbH](https://shellybits.ch/)
|
|
273
293
|
|
|
274
294
|
## License
|
|
275
295
|
|
data/Rakefile
CHANGED
|
@@ -185,7 +185,7 @@ if defined? JRUBY_VERSION
|
|
|
185
185
|
#directory classes = 'pkg/classes'; CLEAN << classes
|
|
186
186
|
|
|
187
187
|
file jar_file => FileList[ 'src/java/**/*.java' ] do
|
|
188
|
-
source = target = '1.
|
|
188
|
+
source = target = '1.8'; debug = true
|
|
189
189
|
|
|
190
190
|
get_driver_jars_local = lambda do |*args|
|
|
191
191
|
driver_deps = args.empty? ? [ :Postgres, :MySQL ] : args
|
data/Rakefile.jdbc
CHANGED
|
@@ -17,4 +17,11 @@ desc "Build and install #{name}-#{version} gem into system gems"
|
|
|
17
17
|
task('install') { gem_helper.install_gem }
|
|
18
18
|
|
|
19
19
|
desc "Create tag #{version_tag} build and push #{name}-#{version} gem to Rubygems"
|
|
20
|
-
task('release')
|
|
20
|
+
task('release') do
|
|
21
|
+
gem_helper.instance_eval do
|
|
22
|
+
guard_clean
|
|
23
|
+
built_gem_path = build_gem
|
|
24
|
+
tag_version unless already_tagged?
|
|
25
|
+
rubygem_push(built_gem_path) if gem_push?
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -11,13 +11,10 @@ Gem::Specification.new do |gem|
|
|
|
11
11
|
gem.license = 'BSD-2-Clause'
|
|
12
12
|
gem.summary = 'JDBC adapter for ActiveRecord, for use within JRuby on Rails.'
|
|
13
13
|
gem.description = "" <<
|
|
14
|
-
"AR-JDBC is a database adapter for Rails' ActiveRecord component
|
|
15
|
-
"to be used with JRuby built upon Java's JDBC API for
|
|
16
|
-
"Provides (ActiveRecord) built-in adapters: MySQL,
|
|
17
|
-
"
|
|
18
|
-
"DB2, FireBird and even Java (embed) databases: Derby, HSQLDB and H2. " <<
|
|
19
|
-
"It allows to connect to virtually any JDBC-compliant database with your " <<
|
|
20
|
-
"JRuby on Rails application."
|
|
14
|
+
"AR-JDBC is a database adapter for Rails' ActiveRecord component " <<
|
|
15
|
+
"designed to be used with JRuby built upon Java's JDBC API for " <<
|
|
16
|
+
"database access. Provides (ActiveRecord) built-in adapters: MySQL, " <<
|
|
17
|
+
"PostgreSQL, SQLite3, and SQLServer."
|
|
21
18
|
|
|
22
19
|
gem.require_paths = ["lib"]
|
|
23
20
|
|
|
@@ -37,14 +34,14 @@ Gem::Specification.new do |gem|
|
|
|
37
34
|
#gem.requirements << "jar org.postgresql:postgresql, 42.1.4.jre6, :scope => :compile"
|
|
38
35
|
|
|
39
36
|
# compilation .jar dependencies for extension (at least until `mvn') :
|
|
40
|
-
gem.add_development_dependency 'jdbc-mysql', '~>
|
|
37
|
+
gem.add_development_dependency 'jdbc-mysql', '~> 8.0.0'
|
|
41
38
|
gem.add_development_dependency 'jdbc-postgres', '~> 42.1'
|
|
42
39
|
end
|
|
43
40
|
|
|
44
41
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
|
45
42
|
gem.test_files = gem.files.grep(%r{^test/})
|
|
46
43
|
|
|
47
|
-
gem.add_dependency 'activerecord', '~>
|
|
44
|
+
gem.add_dependency 'activerecord', '~> 6.1.0'
|
|
48
45
|
|
|
49
46
|
#gem.add_development_dependency 'test-unit', '2.5.4'
|
|
50
47
|
#gem.add_development_dependency 'test-unit-context', '>= 0.3.0'
|
|
@@ -5,21 +5,18 @@ Gem::Specification.new do |gem|
|
|
|
5
5
|
path = File.expand_path('lib/arjdbc/version.rb', File.dirname(__FILE__))
|
|
6
6
|
gem.version = File.read(path).match( /.*VERSION\s*=\s*['"](.*)['"]/m )[1]
|
|
7
7
|
gem.platform = 'java' # due jar-dependencies to resolve requirements for ext
|
|
8
|
-
gem.authors = ['Nick Sieger, Ola Bini, Karol Bucek and JRuby contributors']
|
|
9
|
-
gem.email = ['nick@nicksieger.com', 'ola.bini@gmail.com', 'self@kares.org']
|
|
8
|
+
gem.authors = ['Nick Sieger, Ola Bini, Karol Bucek, Jesse Chavez, and JRuby contributors']
|
|
9
|
+
gem.email = ['nick@nicksieger.com', 'ola.bini@gmail.com', 'self@kares.org', 'jesse.chavez.r@gmail.com']
|
|
10
10
|
gem.homepage = 'https://github.com/JesseChavez/activerecord-jdbc-adapter'
|
|
11
11
|
gem.license = 'BSD-2-Clause'
|
|
12
12
|
gem.summary = 'ActiveRecord JDBC adapter, for use within JRuby on Rails and SQL Server'
|
|
13
13
|
gem.description = "" <<
|
|
14
14
|
"Fork of the ActiveRecord JDBC adapter with support for SQL Server and Azure SQL, " <<
|
|
15
15
|
"for more information and help look at the README file in the github repository. " <<
|
|
16
|
-
"AR-JDBC is a database adapter for Rails' ActiveRecord component
|
|
17
|
-
"to be used with JRuby built upon Java's JDBC API for
|
|
18
|
-
"Provides (ActiveRecord) built-in adapters: MySQL,
|
|
19
|
-
"
|
|
20
|
-
"DB2, FireBird and even Java (embed) databases: Derby, HSQLDB and H2. " <<
|
|
21
|
-
"It allows to connect to virtually any JDBC-compliant database with your " <<
|
|
22
|
-
"JRuby on Rails application."
|
|
16
|
+
"AR-JDBC is a database adapter for Rails' ActiveRecord component " <<
|
|
17
|
+
"designed to be used with JRuby built upon Java's JDBC API for " <<
|
|
18
|
+
"database access. Provides (ActiveRecord) built-in adapters: MySQL, " <<
|
|
19
|
+
"PostgreSQL, SQLite3, and SQLServer."
|
|
23
20
|
|
|
24
21
|
gem.require_paths = ["lib"]
|
|
25
22
|
|
|
@@ -39,19 +36,19 @@ Gem::Specification.new do |gem|
|
|
|
39
36
|
#gem.requirements << "jar org.postgresql:postgresql, 42.1.4.jre6, :scope => :compile"
|
|
40
37
|
|
|
41
38
|
# compilation .jar dependencies for extension (at least until `mvn') :
|
|
42
|
-
gem.add_development_dependency 'jdbc-mysql', '~>
|
|
39
|
+
gem.add_development_dependency 'jdbc-mysql', '~> 8.0.0'
|
|
43
40
|
gem.add_development_dependency 'jdbc-postgres', '~> 42.1'
|
|
44
41
|
end
|
|
45
42
|
|
|
46
43
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
|
47
44
|
gem.test_files = gem.files.grep(%r{^test/})
|
|
48
45
|
|
|
49
|
-
gem.add_dependency 'activerecord', '~>
|
|
46
|
+
gem.add_dependency 'activerecord', '~> 6.1.0'
|
|
50
47
|
|
|
51
48
|
#gem.add_development_dependency 'test-unit', '2.5.4'
|
|
52
49
|
#gem.add_development_dependency 'test-unit-context', '>= 0.3.0'
|
|
53
50
|
#gem.add_development_dependency 'mocha', '~> 0.13.1'
|
|
54
51
|
|
|
55
|
-
gem.rdoc_options = ["--main", "README.md", "-
|
|
52
|
+
gem.rdoc_options = ["--main", "README.md", "-HN", "-f", "darkfish"]
|
|
56
53
|
end
|
|
57
54
|
|