-
-
Save gaurish/6eec42d62ee40b15da105be8eda9a6fc to your computer and use it in GitHub Desktop.
this works
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jruby-9.3.3.0 :002 > require 'java' | |
=> false | |
jruby-9.3.3.0 :004 > require Rails.root.join('vendor','snowflake-jdbc-3.13.14.jar') | |
=> false | |
jruby-9.3.3.0 :005 > ENV['SNOWFLAKE_DB_URL'] | |
=> "jdbc:snowflake://xxxx.us-east-1.snowflakecomputing.com?user=user@gmail.com&password=password$&db=LARGE_SAMPLE_DATA&schema=USERS&warehouse=POC" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
require Rails.root.join('vendor','snowflake-jdbc-3.13.14.jar') | |
class FetchEnqueueJob < ApplicationJob | |
def perform | |
connection = java.sql.DriverManager.getConnection(ENV['SNOWFLAKE_DB_URL']) | |
statement = connection.create_statement | |
# >Traceback (most recent call last): | |
# Java::JavaSql::SQLException (No suitable driver found for jdbc:snowflake://xxxx.us-east-1.snowflakecomputing.com?user=user@gmail.com&password=password$&db=LARGE_SAMPLE_DATA&schema=USERS&warehouse=POC) | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
require '/Users/gaurish/code/projects/snowflake-jdbc-3.13.14.jar' | |
connection_str = ENV['SNOWFLAKE_DB_URL'] | |
conn = java.sql.DriverManager.getConnection(connection_str) | |
statement = conn.createStatement | |
query = 'select id, email from users' | |
result_set = statement.execute_query(query) | |
col_count = result_set.get_meta_data.get_column_count | |
while (result_set.next) do | |
(1..col_count).each do |i| | |
print "#{i} => #{result_set.get_string(i)}}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment