Making ODBC connections without explicitly coding a password

A

Anne Burgess

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.
 
T

Todd Benson

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
 
J

Jim Clark

Anne said:
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
 
A

Anne Burgess

Jim said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top