So, as it turns out, I actually don't need a connection string at all for 
this to work.


require 'sequel'
require 'logger'
connection_string = '' # yup. an empty string since it's defined in 
/etc/odbc.ini
db = Sequel.odbc(drvconnect: connection_string)
db.loggers << Logger.new($stdout)
tables = db[:QSYS2__SYSTABLES].where("TABLE_NAME like ?", "SYS%")
tables.each { |r| puts r[:table_name] }


I renamed my DSN in my /etc/odbc.ini from "MYHOST" to "default", and then 
just passed an empty string to the "drvconnect", and it worked! 

Just gonna leave this link here for anyone else that comes across this and 
needs the help 
http://stackoverflow.com/questions/36049056/ruby-sequel-as-400-connection-issues/36092452#36092452


Thanks!
~Jeremy





On Wednesday, March 16, 2016 at 6:38:39 PM UTC-7, Jeremy Evans wrote:
>
> On Wednesday, March 16, 2016 at 6:18:14 PM UTC-7, Jeremy Woertink wrote:
>>
>> Hey, I know this is a few years later, but I'm hoping you can help me. I 
>> have the same issue. I need to connect to an AS/400 system, but I'm not 
>> familiar with ODBC or AS/400. I don't understand the error I'm getting...
>>
>>
>> require 'sequel'
>> db = Sequel.odbc(drvconnect: 'driver={IBM i Access ODBC 
>> Driver};system=MYHOST;uid=MYUSERNAME;password=MYPASSWORD;')
>> tables = db[:QSYS2__SYSTABLES].where("TABLE_NAME like ?", "SYS%")
>> tables.each { |r| puts r[:table_name] }
>>
>> #=> Sequel::DatabaseConnectionError: ODBC::Error: IM002 (0) 
>> [unixODBC][Driver Manager]Data source name not found, and no default driver 
>> specified
>>
>> What's a "Data source name", and how do I specify it
>>
>
> I have no experience with AS/400, so I'm not sure.  This doesn't appear a 
> Sequel issue.  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.
>
> 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.

Reply via email to