简体   繁体   中英

Connecting to oracle database using Connection string Issue?

I have an application which is using config file to connect to mssql server and odbc is created and used in the config file.

This is the line in my config file to connect to database.

<add key="ConnectionString" value="Data Source=<DSN Name>;Initial Catalog=<DAtabase Name>;Integrated Security=True"></add>

Now we are testing in Oracle, but the above format is not connecting and I had tried many other permutations of connection string like below but so far no luck

This is same like Windows string

<add key="ConnectionString" value="Data Source=<DSN Name>;Integrated Security=True"></add>

Included my Database Name with DSN

  <add key="ConnectionString" value="Data Source=<DSN Name>;Initial Catalog=<DAtabase Name>;Integrated Security=True"></add>

Included Driver and SID here

<add key="ConnectionString" value= Driver=<{Oracle in OraClient11g_home1}>;Server=serverSID;Uid=<myUsername>;password=<password>
></add>

The error I am receiving

Database setup cannot find the database mentioned in the config file

None of them are working wats the correct connection string for Oracle ?

Try DBQ= instead of Server= and PWD= instead of password= .

Attribute Server is used for the Microsoft ODBC Driver (see Connection String Format and Attributes ). In Oracle the attribute is DBQ (see Using the Oracle ODBC Driver ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM