.comment-link {margin-left:.6em;}
Gert .Net
[GertDotNet]
20041206
 
The connection string to Oracle
Parts that make up the connection string:

This makes a connection string like this:

User ID=MyName;Password=Asecret007;Data Source=server_database

But actually this is the name in the TNSNames.Ora file that maps to a full blown connection string.

The TNSNames.Ora can be found (on my system):

C:\oraNT\NETWORK\ADMIN\Tnsnames.ora.

You can built it using the Oracle Net Configuration Assistant. Choose "Local Net Service Name configuration" to Add, modify or delete.

I noticed that the OracleConnection fails when the Data Source is longer as 16 characters.

Example:


try {
using (OracleConnection con = new OracleConnection(
"User ID=MyName;Password=Asecret007;Data Source=server_database")) {
con.Open();
}
MessageBox.Show(this, "Connection successfull", "Success");
} catch (Exception ex) {
MessageBox.Show(this, "Connection failed\n" + ex.Message, "Connection failed");
}


Powered by Blogger