ORA-06413: Connection not open.

Dear All,

I had encountered the following error code

ex.Message = "ERROR [HY000] [Oracle][ODBC][Ora]ORA-06413: Connection not open.
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
ERROR [HY000] [Oracle][ODBC][Ora]ORA-06413: Connection not open.

while running the code as below :

try

{

// Build a connection and SQL strings

string connectionString = @"DSN=EDC;UID=afpduser;PWD=afpduser;Integrated Security=no;";

// SQL String

// Create connection object

OdbcConnection conn = new OdbcConnection(connectionString);

// Create command object

OdbcCommand cmd = new OdbcCommand(SQL);

cmd.Connection = conn;

// Open connection

conn.Open();

// Call command's ExecuteReader

OdbcDataReader reader = cmd.ExecuteReader();

// Read the reader and display results on the console

string data = null;

string result;

while (reader.Read())

{

data = "";

for (int i = 0; i < 20; i++)

{

if (reader.IsDBNull(i) == false)

{

result = reader.GetValue(i).ToString();

}

else

{

result = "null";

}

data = data + "'" + result + "', ";

}

data = data.Substring(0, data.Length - 2);

SaveToAccessLotBased(data, eqpType);

}

// close reader and connection

reader.Close();

conn.Close();

}

catch (OdbcException ex)

{

myLog.WriteEntry("ODBCException Error 2: " + ex.Message + " " +DateTime.Now.ToString());

}

}

I had created the data source EDC using Oracle ODBC Driver and disable MTS Support. But I am still not able to resolve the problem. Can anyone please help

I heard that there is another way of using dsnless connection to oracle. May I know how to do it

Thanks



Answer this question

ORA-06413: Connection not open.

  • oergelmir

    Error: ORA 6413
    Text: Connection not open.
    ------------------------------------------------------------
    Cause: Unable to establish connection.
    Action: Use diagnostic procedures to ascertain exact problem.


    Solution Description
    --------------------

    You are starting the application from a directory with a special
    character in the name.
    A simple testcase:
    create a directory c:test(4)
    copy odbctst.exe to this directory and start it from this directory
    you will get the ora-6413 when trying to connect to an oracle database

    The error is caused by the paranthesis in the directory name.

    Remove the special characters from the directory name and everything
    will work as designed.

  • ORA-06413: Connection not open.