0

I'm trying to write a .Net 4.7.2 console app that connects with an Oracle database using the Managed driver in VS 2019. I've added the Oracle.ManagedDataAccess v19.6.0 package to my project via the PacketManager. Following along with the Oracle Data Provider for .Net Developers guide's simple example, I get an exception when I open the connection, "Input string was not in a correct format.". Here's my code, any help would be appreciated.

    using Oracle.ManagedDataAccess.Client;
public static void TestOracleConnection()
{
    try
    {
        string connString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.xxx.xxx.xxx)(PORT=‌​1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=Test)));User Id=user;Password=password;";
        OracleConnection conn = new OracleConnection(connString);
        conn.Open();
        conn.Dispose();
    }
    catch (Exception ex)
    {
    }
}
VillageTech
  • 1,968
  • 8
  • 18
Mark S
  • 81
  • 1
  • 1
  • 5
  • 1
    After `PORT=‌​1521` remove one `)` and add `)` at the end of Data Source. – Ulugbek Umirov Dec 11 '19 at 09:15
  • Or you can use EZCONNECT `Data Source=10.xxx.xxx.xxx:1521/Test;User Id=user;Password=password;` – Ulugbek Umirov Dec 11 '19 at 09:37
  • This worked. I went over that connection string above in detail comparing it to the source format that I took it from and thought it was correct. Thank you for your help. – Mark S Dec 11 '19 at 19:01

0 Answers0