Thursday, 5 September 2013

Oracle connection string without a DSN

Oracle connection string without a DSN

I currently connect to an Oracle database in C#. NET2.0 using the
following database connection string:
Dsn=myDSNs;uid=me;pwd=mypassword
What I'd really like to do is connect using a connection string that
doesn't need a DSN (to save me configuring ~100 machines).
I've tried many variations of the following:
Data
Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=myService)));
uid=me; pwd=mypassword;
But keep getting the following exception;
ExceptionType: OdbcException
Message: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name
not found and no default driver specified
I'm fairly confident the parameters (service name, port, host) are correct
as they are used in another client that works so I'm starting to wander if
I'm barking up the wrong tree? Any enlightenment would be great.

No comments:

Post a Comment