Sybase ODBC驱动程序客户端无法建立连接

时间:2022-11-09 18:55:43

I am trying to hit a remote Sybase database using ODBC. I have written a C# program with the following code

我试图使用ODBC命中远程Sybase数据库。我用以下代码编写了一个C#程序

     try
      {
         String conString = "Driver={Adaptive Server Enterprise};server=ipAddress;port=portNumber;db=databaseName;uid=strUserName;pwd=strPassword";
         con = new OdbcConnection(conString);
         con.Open();
       }
       catch (Exception exp)
        {
         con = null;

        }

After the connection times out ,the exception message says :- ERROR [08001] [Sybase][ODBC Driver]Client unable to establish a connection

连接超时后,异常消息显示: - 错误[08001] [Sybase] [ODBC驱动程序]客户端无法建立连接

On Debugging the code when I hover on "con.Open()", the ServerVersion attribute of the connection object displays the following message 'con.ServerVersion' threw an exception type 'System.InvalidOperationException'

在我将鼠标悬停在“con.Open()”上时调试代码,连接对象的ServerVersion属性显示以下消息'con.ServerVersion'抛出异常类型'System.InvalidOperationException'

Can anybody help me in finding out the reason for this exception..?

任何人都可以帮我找出这个例外的原因..?

1 个解决方案

#1


I would double check first that you can connect via a normal SQL client (e.g. isql, Aqua etc) on the same hostname and port.

我会首先仔细检查您是否可以通过普通的SQL客户端(例如isql,Aqua等)在同一主机名和端口上进行连接。

However that looks from a quick google like a possible Sybase Adaptive Anywhere (as opposed to Enterprise) error so are you using the right driver for the type of database? They are two different products.

然而,从快速谷歌看起来像可能的Sybase Adaptive Anywhere(而不是Enterprise)错误,所以你使用正确的驱动程序的数据库类型?它们是两种不同的产品。

#1


I would double check first that you can connect via a normal SQL client (e.g. isql, Aqua etc) on the same hostname and port.

我会首先仔细检查您是否可以通过普通的SQL客户端(例如isql,Aqua等)在同一主机名和端口上进行连接。

However that looks from a quick google like a possible Sybase Adaptive Anywhere (as opposed to Enterprise) error so are you using the right driver for the type of database? They are two different products.

然而,从快速谷歌看起来像可能的Sybase Adaptive Anywhere(而不是Enterprise)错误,所以你使用正确的驱动程序的数据库类型?它们是两种不同的产品。