{"id":13463054,"url":"https://github.com/jruby/activerecord-jdbc-adapter","last_synced_at":"2025-05-13T16:09:10.856Z","repository":{"id":387780,"uuid":"5266","full_name":"jruby/activerecord-jdbc-adapter","owner":"jruby","description":"JRuby's ActiveRecord adapter using JDBC.","archived":false,"fork":false,"pushed_at":"2025-02-28T22:54:15.000Z","size":276397,"stargazers_count":466,"open_issues_count":93,"forks_count":384,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-05-08T03:35:29.290Z","etag":null,"topics":["activerecord","activerecord-jdbc-adapter","ar-jdbc","jruby","rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jruby.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":"AR-JDBC is (currently) a volunteer effort, it is not backed by any company ... You can contribute and make a difference for all JRuby on Rails sites out there."},"created_at":"2008-03-25T15:46:40.000Z","updated_at":"2025-05-04T15:04:58.000Z","dependencies_parsed_at":"2024-01-18T18:26:26.114Z","dependency_job_id":"419a61cf-9be5-4963-b09d-76345436588d","html_url":"https://github.com/jruby/activerecord-jdbc-adapter","commit_stats":{"total_commits":4179,"total_committers":191,"mean_commits":21.87958115183246,"dds":0.5675999042833213,"last_synced_commit":"fc3c89820f3be458264b8f6344a925e46bf1342c"},"previous_names":[],"tags_count":230,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jruby%2Factiverecord-jdbc-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jruby%2Factiverecord-jdbc-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jruby%2Factiverecord-jdbc-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jruby%2Factiverecord-jdbc-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jruby","download_url":"https://codeload.github.com/jruby/activerecord-jdbc-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253068797,"owners_count":21848868,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activerecord","activerecord-jdbc-adapter","ar-jdbc","jruby","rails"],"created_at":"2024-07-31T13:00:45.099Z","updated_at":"2025-05-13T16:09:05.844Z","avatar_url":"https://github.com/jruby.png","language":"Ruby","readme":"# ActiveRecord JDBC Adapter\n\n[![Gem Version](https://badge.fury.io/rb/activerecord-jdbc-adapter.svg)][7]\n\nActiveRecord-JDBC-Adapter (AR-JDBC) is the main database adapter for Rails'\n*ActiveRecord* component that can be used with [JRuby][0].\nActiveRecord-JDBC-Adapter provides full or nearly full support for:\n**MySQL**, **PostgreSQL**, **SQLite3** and **MSSQL*** (SQLServer).\n\nUnless we get more contributions we will not be supporting more adapters.\nNote that the amount of work needed to get another adapter is not huge but\nthe amount of testing required to make sure that adapter continues to work\nis not something we can do with the resources we currently have.\n\n- for **Oracle** database users you are encouraged to use\n  https://github.com/rsim/oracle-enhanced\n- **MSSQL** adapter's gem parts reside in a [separate repository][8]\n\nVersions are targeted at certain versions of Rails and live on their own branches.\n\n| Gem Version | Rails Version | Branch    | min JRuby | min Java |\n| ----------- | ------------- | --------- | --------- | -------- |\n| 50.x        | 5.0.x         | 50-stable | 9.1.x     | 7        |\n| 51.x        | 5.1.x         | 51-stable | 9.1.x     | 7        |\n| 52.x        | 5.2.x         | 52-stable | 9.1.x     | 7        |\n| 60.x        | 6.0.x         | 60-stable | 9.2.7     | 8        |\n| 61.x        | 6.1.x         | 61-stable | 9.2.7     | 8        |\n| 70.x        | 7.0.x         | 70-stable | 9.3.0     | 8        |\n| 71.x        | 7.1.x         | 71-stable | 9.4.3     | 8        |\n| 72.x        | 7.2.x         | master    | 9.4.3     | 8        |\n\nNote: 72.x is still under development and not supported yet.\n\nNote that JRuby 9.1.x and JRuby 9.2.x are at end-of-life. We recommend Java 8\nat a minimum for all versions.\n\n## Using ActiveRecord JDBC\n\n### Inside Rails\n\nTo use AR-JDBC with JRuby on Rails:\n\n1. Choose the adapter you wish to gem install. The following pre-packaged\nadapters are available:\n\n  - MySQL (`activerecord-jdbcmysql-adapter`)\n  - PostgreSQL (`activerecord-jdbcpostgresql-adapter`)\n  - SQLite3 (`activerecord-jdbcsqlite3-adapter`)\n  - MSSQL (`activerecord-jdbcsqlserver-adapter`)\n\n2. If you're generating a new Rails application, use the following command:\n\n    jruby -S rails new sweetapp\n\n3. Configure your *database.yml* in the normal Rails style:\n\n```yml\ndevelopment:\n  adapter: mysql2\n  database: blog_development\n  username: blog\n  password: 1234\n```\n\nFor JNDI data sources, you may simply specify the JNDI location as follows, it's\nrecommended to use the same adapter: setting as one would configure when using\n\"bare\" (JDBC) connections e.g. :\n\n```yml\nproduction:\n  adapter: postgresql\n  jndi: jdbc/PostgreDS\n```\n\n**NOTE:** any other settings such as *database:*, *username:*, *properties:* make\nno difference since everything is already configured on the JNDI DataSource end.\n\nJDBC driver specific properties might be set if you use an URL to specify the DB\nor preferably using the *properties:* syntax:\n\n```yml\nproduction:\n  adapter: mysql2\n  username: blog\n  password: blog\n  url: \"jdbc:mysql://localhost:3306/blog?profileSQL=true\"\n  properties: # specific to com.mysql.jdbc.Driver\n    socketTimeout:  60000\n    connectTimeout: 60000\n```\n\n#### MySQL specific notes\n\nDepending on the MySQL server configuration, it might be required to set\nadditional connection properties for date/time support to work correctly. If you\nencounter problems, try adding this to your database configuration:\n\n```yml\n  properties:\n    serverTimezone: \u003c%= java.util.TimeZone.getDefault.getID %\u003e\n```\n\nThe correct timezone depends on the system setup, but the one shown is a good\nplace to start and is actually the correct setting for many systems.\n\n\n### Standalone with ActiveRecord\n\nOnce the setup is made (see below) you can establish a JDBC connection like this\n(e.g. for `activerecord-jdbcderby-adapter`):\n\n```ruby\nActiveRecord::Base.establish_connection(\n  adapter: 'sqlite3',\n  database: 'db/my-database'\n)\n```\n\n#### Using Bundler\n\nProceed as with Rails; specify `ActiveRecord` in your Bundle along with the\nchosen JDBC adapter(s), this time sample *Gemfile* for MySQL:\n\n```ruby\ngem 'activerecord', '~\u003e 6.0.3'\ngem 'activerecord-jdbcmysql-adapter', '~\u003e 60.2', :platform =\u003e :jruby\n```\n\nWhen you `require 'bundler/setup'` everything will be set up for you as expected.\n\n#### Without Bundler\n\nInstall the needed gems with JRuby, for example:\n\n    gem install activerecord -v \"~\u003e 6.0.3\"\n    gem install activerecord-jdbc-adapter -v \"~\u003e 60.2\" --ignore-dependencies\n\nIf you wish to use the adapter for a specific database, you can install it\ndirectly and the (jdbc-) driver gem (dependency) will be installed as well:\n\n    jruby -S gem install activerecord-jdbcmysql-adapter -v \"~\u003e 60.2\"\n\nYour program should include:\n\n```ruby\nrequire 'active_record'\nrequire 'activerecord-jdbc-adapter' if defined? JRUBY_VERSION\n```\n\n## Source\n\nThe source for activerecord-jdbc-adapter is available using git:\n\n    git clone git://github.com/jruby/activerecord-jdbc-adapter.git\n\nPlease note that the project manages multiple gems from a single repository,\nif you're using *Bundler* \u003e= 1.2 it should be able to locate all gemspecs from\nthe git repository. Sample *Gemfile* for running with (MySQL) master:\n\n```ruby\ngem 'activerecord-jdbc-adapter', :github =\u003e 'jruby/activerecord-jdbc-adapter'\ngem 'activerecord-jdbcmysql-adapter', :github =\u003e 'jruby/activerecord-jdbc-adapter'\n```\n\n## Getting Involved\n\nPlease read our [CONTRIBUTING](CONTRIBUTING.md) \u0026 [RUNNING_TESTS](RUNNING_TESTS.md)\nguides for starters. You can always help us by maintaining AR-JDBC's [wiki][5].\n\n## Feedback\n\nPlease report bugs at our [issue tracker][3]. If you're not sure if\nsomething's a bug, feel free to pre-report it on the [mailing lists][1] or\nask on the #JRuby IRC channel on http://freenode.net/ (try [web-chat][6]).\n\n## Authors\n\nThis project was originally written by [Nick Sieger](http://github.com/nicksieger)\nand [Ola Bini](http://github.com/olabini) with lots of help from the JRuby community.\nPolished 3.x compatibility and 4.x support (for AR-JDBC \u003e= 1.3.0) was managed by\n[Karol Bucek](http://github.com/kares) among others. Support for Rails 6.0 and 6.1 was\ncontributed by [shellyBits GmbH](https://shellybits.ch/)\n\n## License\n\nActiveRecord-JDBC-Adapter is open-source released under the BSD/MIT license.\nSee [LICENSE.txt](LICENSE.txt) included with the distribution for details.\n\nOpen-source driver gems within AR-JDBC's sources are licensed under the same\nlicense the database's drivers are licensed. See each driver gem's LICENSE.txt.\n\n[0]: http://www.jruby.org/\n[1]: http://jruby.org/community\n[2]: http://github.com/jruby/activerecord-jdbc-adapter/blob/master/activerecord-jdbcmssql-adapter\n[3]: https://github.com/jruby/activerecord-jdbc-adapter/issues\n[4]: http://github.com/nicksieger/activerecord-cachedb-adapter\n[5]: https://github.com/jruby/activerecord-jdbc-adapter/wiki\n[6]: https://webchat.freenode.net/?channels=#jruby\n[7]: http://badge.fury.io/rb/activerecord-jdbc-adapter\n[8]: https://github.com/jruby/activerecord-jdbcsqlserver-adapter\n","funding_links":[],"categories":["Data Persistence"],"sub_categories":["SQL Database Adapters"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjruby%2Factiverecord-jdbc-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjruby%2Factiverecord-jdbc-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjruby%2Factiverecord-jdbc-adapter/lists"}