jdbc-pgsql 0.1.0-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3c058cd4f95bd8883a59e87b0ce6592b758fb28e20b69ced0c22214f12bd1b31
4
+ data.tar.gz: a34cabe5f179d602758734b220ade56a741e1d82f1a3b848e77a6f9537ec4d91
5
+ SHA512:
6
+ metadata.gz: 0a76e6aa7a10d83716a7ee65c13c485e21ef106ab25bd976ce6e837e0a6c3a9805bf60177b8e855aeac1153440ac96617d58c13715249a12f141cb97175ab40d
7
+ data.tar.gz: fd57548d2b2dc8ef8a2731ed6fc458e4fa1b8a9a7478162dda4767c40f9de34b68aaf6eabe979ab78edb0119756146e46b1e6c8a2ecf4c082c63f944ac637f5e
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 1997, PostgreSQL Global Development Group
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
+ POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,86 @@
1
+ # Jdbc::Pgsql
2
+
3
+ This Ruby gem loads the PostgreSQL JDBC driver.
4
+ Install this gem and `require 'jdbc/pgsql'` within JRuby
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'jdbc-pgsql'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install jdbc-pgsql
21
+
22
+ ## Usage
23
+
24
+ This is a very minimal and basic sample.
25
+
26
+ ```ruby
27
+ require 'jdbc/pgsql'
28
+
29
+ url = 'jdbc:postgresql://localhost:5432/sample_database'
30
+
31
+ other_props = [
32
+ 'user=dev_user',
33
+ 'password=user_password'
34
+ ].join('&')
35
+
36
+ connection = java.sql.DriverManager.getConnection(url + '?' + other_props)
37
+
38
+ statement = connection.createStatement
39
+
40
+ sql_query = 'SELECT * FROM users'
41
+
42
+ result = statement.executeQuery(sql_query)
43
+
44
+ while result.next
45
+ puts [result.getString(1), result.getString(2), result.getString(3)]
46
+ end
47
+ ```
48
+
49
+ For more details follow PostgreSQL Jdbc documentation and JRuby conventions to call java methods.
50
+
51
+ ## Supported Java versions
52
+
53
+ For supported Java version use Gem versions as per below table:
54
+
55
+ | Java version | Gem version | used driver |
56
+ | ------------ | ------------- | ----------- |
57
+ | 8 | 0.1.0 | 42.2.5 |
58
+ | 11 | 0.1.0 | 42.2.5 |
59
+
60
+ ## Other Java versions
61
+
62
+ For other Java version use Gem versions as per below table:
63
+
64
+ | Java version | Gem version | used driver |
65
+ | ------------ | ------------- | ----------- |
66
+ | 7 | 0.1.0 | 42.2.5 |
67
+ | 9 | 0.1.0 | 42.2.5 |
68
+ | 10 | 0.1.0 | 42.2.5 |
69
+
70
+ ## Development
71
+
72
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
73
+
74
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
75
+
76
+ ## Contributing
77
+
78
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jdbc-pgsql. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
79
+
80
+ ## License
81
+
82
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
83
+
84
+ ## Code of Conduct
85
+
86
+ Everyone interacting in the Jdbc::Mssql project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/jdbc-pgsql/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,47 @@
1
+ warn 'jdbc-pgsql must be used with JRuby only' unless defined? JRUBY_VERSION
2
+
3
+ require 'jdbc/pgsql/version'
4
+
5
+ module Jdbc
6
+ module Pgsql
7
+ JAVA_VERSIONS = {
8
+ '1.8' => 8,
9
+ '9' => 9,
10
+ '10' => 9,
11
+ '11' => 11
12
+ }.freeze
13
+
14
+ JAVA_DRIVER_VERSIONS = {
15
+ '1.8' => '42.2.5',
16
+ '9' => '42.2.5',
17
+ '10' => '42.2.5',
18
+ '11' => '42.2.5'
19
+ }.freeze
20
+
21
+ def self.java_specification_version
22
+ ENV_JAVA['java.specification.version']
23
+ end
24
+
25
+ def self.jre_version
26
+ JAVA_VERSIONS[java_specification_version]
27
+ end
28
+
29
+ def self.driver_version
30
+ JAVA_DRIVER_VERSIONS[java_specification_version]
31
+ end
32
+
33
+ def self.jar_file
34
+ "postgresql-#{driver_version}.jar"
35
+ end
36
+
37
+ def self.load_driver
38
+ warn 'loading JDBC driver on require "jdbc/pgsql"' if $VERBOSE
39
+
40
+ raise 'No JDBC driver for your java version' if jre_version.nil? || driver_version.nil?
41
+
42
+ require jar_file
43
+ end
44
+
45
+ load_driver
46
+ end
47
+ end
@@ -0,0 +1,5 @@
1
+ module Jdbc
2
+ module Pgsql
3
+ VERSION = '0.1.0'.freeze
4
+ end
5
+ end
Binary file
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jdbc-pgsql
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: java
6
+ authors:
7
+ - Jesse Chavez
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-10-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: 2.1.4
19
+ name: bundler
20
+ prerelease: false
21
+ type: :development
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.1.4
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '12.0'
33
+ name: rake
34
+ prerelease: false
35
+ type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.0'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.0'
47
+ name: rspec
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: Loads the PostgreSQL JDBC driver. Install this gem and require 'jdbc/pgsql'
56
+ within JRuby
57
+ email:
58
+ - jesse.chavez.r@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - LICENSE
64
+ - README.md
65
+ - lib/jdbc/pgsql.rb
66
+ - lib/jdbc/pgsql/version.rb
67
+ - lib/postgresql-42.2.5.jar
68
+ homepage: https://github.com/JesseChavez/jdbc-pgsql
69
+ licenses:
70
+ - MIT
71
+ metadata: {}
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubyforge_project:
88
+ rubygems_version: 2.7.10
89
+ signing_key:
90
+ specification_version: 4
91
+ summary: JDBC driver for JRuby and PostgreSQL
92
+ test_files: []