require 'odbc' # gem 'ruby-odbc'
require 'sequel' # gem 'sequel'
begin
db = Sequel.odbc('testodbc1', user: 'admin', password: 'password')
puts 'SELECT * FROM ITEM LIMIT 10'
db.fetch('SELECT * FROM ITEM LIMIT 10') do |row|
puts row
end
rescue = e
puts 'An error occurred'
puts "Error code: #{e.inspect}"
ensure
# disconnect from server
db.disconnect if db
end
Data Service Name(DSN) are stored in odbc.ini file
[ODBC Data Sources]
testodbc1 = SnowflakeDSIIDriver
[testodbc1]
Driver = <PATH>/lib/libSnowflake.so
Description =
server = abcd.snowflakecomputing.com
role = sysadmin
database = adminDB
warehouse = LOAD_WH
I am able to connect by configuring the parameters in odbc.ini file. But I
am not able to connect database by ODBC connection string(through passing
all parameters in :drvconnect). Can you help me out now?.
Thanks. Your help would be truly appreciated.
On Saturday, November 25, 2017 at 3:29:09 AM UTC+5:30, Jeremy Evans wrote:
>
> On Friday, November 24, 2017 at 1:10:04 PM UTC-8, saiyam agarwal wrote:
>>
>> Okay. No problem.
>>
>>
>> https://github.com/jeremyevans/sequel/blob/master/doc/opening_databases.rdoc
>> In this, for ODBC it is mentioned we can also connect database by ODBC
>> connect string.
>> "Typical usage would be: Sequel.odbc(:drvconnect=>'driver={...};...')"
>>
>> Can you please provide whole syntax to connect database this way?
>>
>
> Please see if you can get a connection using ruby-odbc directly. If you
> can post how get a connection with ruby-odbc, but can't get it working with
> Sequel, I should be able to help getting it to work with Sequel. If you
> can't get a connection using ruby-odbc directly, then unfortunately I won't
> be able to help you.
>
> Thanks,
> Jeremy
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.