ODBC iSeries DSN ODBCConnection Login Format

jamestieman
jamestieman used Ask the Experts™
on
I have a VB.NET application that uses the ODBCConnection object to connect to a DSN that is defined using the iSeries Access ODBC driver.  Right now, I can connect  using the DSN name "AS400", like this: dsn=AS400 as the connection string.  
The problem is... my application doesn't Prompt for a user login to the ODBC connection.  Is there a way to add a default user and password to the connection OR a way to bring up a prompt for it the first time a connection is requested?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Is creating a DSN optional?  When I look at the ODBCConnection Class, the ConnectionString can be like:

conn.ConnectionString = "Driver={iSeries Access ODBC Driver};System=my_system_name;Uid=myUsername;Pwd=myPassword;

What would be the System Name?

OR, if a DSN is created:

conn.ConnectionString ="DSN=AS400;UID=myUsername;PWD=myPassword;"

Should I use one over the other?

Commented:
Yes, you can use the DSN or use a DSN-less connection string.  Both formats look OK to me.  If using a DSN, some ODBC providers permit the UID/PWD to be stored in the DSN or appended to the connection string.

I prefer to go DSN-less when possible because the connection string is fully embedded in the application and you don't need to worry about distributing or configuring the DSN on each workstation.  It also avoids a bit of a security concern as there is no DSN that can comandeered for other purposes.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial