Making ODBC connections without explicitly coding a password

We’re developing Ruby programs which read and write from/to DB2 tables
on a mainframe. We’re the first people in the company to use Ruby so
are rather feeling our way. So far we’ve been using our own IDs and
passwords, explicitly coded, to make ODBC connections to access
development tables, but I’ve learnt that due to our security rules I
won’t be allowed to know the password for the ID which will access live
tables. Can anyone please suggest a way round explicitly coding the
password? Thank you.

On 10/25/07, Anne B. [email protected] wrote:

We’re developing Ruby programs which read and write from/to DB2 tables
on a mainframe. We’re the first people in the company to use Ruby so
are rather feeling our way. So far we’ve been using our own IDs and
passwords, explicitly coded, to make ODBC connections to access
development tables, but I’ve learnt that due to our security rules I
won’t be allowed to know the password for the ID which will access live
tables. Can anyone please suggest a way round explicitly coding the
password? Thank you.

You can prompt for a password, but of course that doesn’t work for
automated scripts.

If your DBAs know what they are doing, then security shouldn’t be a
problem with live tables. I’m assuming that you will only be doing
queries and not inserts/updates?

Todd

Anne B. wrote:

We’re developing Ruby programs which read and write from/to DB2 tables
on a mainframe. We’re the first people in the company to use Ruby so
are rather feeling our way. So far we’ve been using our own IDs and
passwords, explicitly coded, to make ODBC connections to access
development tables, but I’ve learnt that due to our security rules I
won’t be allowed to know the password for the ID which will access live
tables. Can anyone please suggest a way round explicitly coding the
password? Thank you.

If you are on Windows, you can set up a system DSN with the username and
password encoded there. Using DBI, you can then just reference the DSN
to access the database such as:

dbh = DBI.connect(“DBD:ODBC:myDSN”)

HTH,
Jim

Jim C. wrote:

Anne B. wrote:

We’re developing Ruby programs which read and write from/to DB2 tables
on a mainframe. We’re the first people in the company to use Ruby so
are rather feeling our way. So far we’ve been using our own IDs and
passwords, explicitly coded, to make ODBC connections to access
development tables, but I’ve learnt that due to our security rules I
won’t be allowed to know the password for the ID which will access live
tables. Can anyone please suggest a way round explicitly coding the
password? Thank you.

If you are on Windows, you can set up a system DSN with the username and
password encoded there. Using DBI, you can then just reference the DSN
to access the database such as:

dbh = DBI.connect(“DBD:ODBC:myDSN”)

HTH,
Jim

Hi Jim

Belated but grateful thanks, this worked very nicely.

Anne

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs