0

We've got a 32 bit .Net windows application which uses ODAC 10g (1.x) to connect to a 10g database on the backend. Things work fine in this deployment.

We're in the process of setting up a new development machine. This machine has ORACLE 11g (64 bit) installed on it. We're running into issues connecting the the database.

This is the code block we're using to connect to the database:

dataString = "user id=xxx;password=\"xxx\";data source=localhost:1521/ORCL";
using (OracleConnection oraconn = new OracleConnection(dataConn))
{
    oraconn.Open();

    Oracle.DataAccess.Client.OracleCommand cmd = new OracleCommand(sOraSQL, oraconn);
    cmd.CommandType = CommandType.Text;
    Oracle.DataAccess.Client.OracleDataAdapter da = new OracleDataAdapter(cmd);

    DataTable dt = new DataTable();
    da.Fill(dt);

    oraconn.Close();
    return dt;
}

We get an exception on the "oraconn.Open()" command.

ora-12514: TNS: listener does not currently know of service requested in connect descriptor

Here is what the TNSNAMES.ORA file looks like:

# tnsnames.ora Network Configuration File: C:\app\DjM\product\11.2.0\dbhome_1    \network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))


ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.168.1.100)
    )
  )

This is what the SQLNET.ORA file looks like:

# This file is actually generated by netca. But if customers choose to 
# install "Software Only", this file wont exist and without the native 
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES = (NTS)

This is what the connection string looks like:

"user id=xxx;password=\"xxx\";data source=localhost:1521/ORCL"

NOTE::

We are able to run SQLDeveloper and point to the same SID (ORCL) and we can connect to the DB instance fine.

We were also able to install 11g 32 bit ODAC on the original machine and it worked fine there.

This has got to be something config related with tnsnames or something along those lines.

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
JohnB
  • 3,921
  • 8
  • 49
  • 99

1 Answers1

0

Try to use connection string like:

Data Source=ORCL;User Id=User;Password=Password;

Here is more examples for oracle.

Robert
  • 25,425
  • 8
  • 67
  • 81