0

I've installed Oracle DB on another pc(A) and trying to establish the connection from my pc(B). Now when I'm trying to debug the application I get this error- "[DBNETLIB][ConnectionOpen (ParseConnectParams()).]Invalid connection."

    public void InsertionTest()

    {            
        string cmdText = @"Insert into O_TEST_TABLE (ID,Name,MOBILE) Values (4, 'rD','798984');";
        string ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["HR"].ConnectionString;

        using (OleDbConnection con = new OleDbConnection(ConnectionString))// "Provider=SQLOLEDB; DATA SOURCE=172.16.1.220:1521/orcl;PASSWORD=hr;PERSIST SECURITY INFO=True;USER ID=hr"))
        using (OleDbCommand cmd = new OleDbCommand(cmdText, con))
        {
            con.Open();

            int rowsUpdated = cmd.ExecuteNonQuery();
            if (rowsUpdated == 0)
            {
                Console.WriteLine("Failed!!!");
            }
            else
            {
                Console.WriteLine("Success.");
            }
        }           
    }

In my web config file, the connection string is-

<connectionStrings>
    <add name="HR" connectionString="Provider=SQLOLEDB;Initial Catalog=HR;DATA SOURCE=172.16.1.13:1521/orcl;PASSWORD=hr;PERSIST SECURITY INFO=True;USER ID=hr; OLEDB.NET=True " /> 
</connectionStrings>
1
  • It looks like you are trying to use an MS SQL Server connection string to connect to the Oracle database. Did you look at the examples on connectionstrings.com? Commented Feb 13, 2018 at 5:23

1 Answer 1

1

I feel provider should be Provider=OraOLEDB.Oracle

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.