A
Anonieko Ramos
QUESTION:
I am receiving this error when I open a connection
" ORA-00162: external dbid length 17 is greater than maximum (16) "
What is wrong?
ANSWER:
If you are using System.OracleClient.dll version 1.0.5000.0, you
can modify your TNSNAMES.ORA and make alias shorter. TNSNAMES.ora
is in oralcle/network/admin directory.
For example: tnsnames.ora file has...
short122.world =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = 133.231.113.280)
(PORT = 1521)
)
(CONNECT_DATA = (SID = ORAQ38)
)
)
NOTE: If you are using the System.OracleClient.dll version
1.0.3300.0, you don't get this problem.
EXAMPLE: In .NET Winforms, populate the datagrid upon button1 click.
private void button1_Click(object sender, System.EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
OracleConnection objOraConn =
new OracleConnection("user id=yourid;data
source=\"short122.world\";password=password");
objOraConn.Open();
string commandString = " SELECT * FROM A_MYTABLE" ;
OracleCommand cmd = objOraConn.CreateCommand();
cmd.CommandText = commandString;
cmd.Prepare();
OracleDataAdapter da = new OracleDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
objOraConn.Close();
// Execute the statement
dataGrid1.DataSource = ds.Tables[0].DefaultView;
Cursor.Current = Cursors.Default;
}
I am receiving this error when I open a connection
" ORA-00162: external dbid length 17 is greater than maximum (16) "
What is wrong?
ANSWER:
If you are using System.OracleClient.dll version 1.0.5000.0, you
can modify your TNSNAMES.ORA and make alias shorter. TNSNAMES.ora
is in oralcle/network/admin directory.
For example: tnsnames.ora file has...
short122.world =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = 133.231.113.280)
(PORT = 1521)
)
(CONNECT_DATA = (SID = ORAQ38)
)
)
NOTE: If you are using the System.OracleClient.dll version
1.0.3300.0, you don't get this problem.
EXAMPLE: In .NET Winforms, populate the datagrid upon button1 click.
private void button1_Click(object sender, System.EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
OracleConnection objOraConn =
new OracleConnection("user id=yourid;data
source=\"short122.world\";password=password");
objOraConn.Open();
string commandString = " SELECT * FROM A_MYTABLE" ;
OracleCommand cmd = objOraConn.CreateCommand();
cmd.CommandText = commandString;
cmd.Prepare();
OracleDataAdapter da = new OracleDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
objOraConn.Close();
// Execute the statement
dataGrid1.DataSource = ds.Tables[0].DefaultView;
Cursor.Current = Cursors.Default;
}