Netezza server cannot be accessed from C# VS2013 by ODBC but can be accessed from "server...

  • Thread starter Thread starter usa2015usa
  • Start date Start date
U

usa2015usa

Guest
I am trying to access a Netezza server from C# .net 4.5 VS2013 on win 7.

using System.Data.Odbc;
string connstring = "Driver={NetezzaSQL};Server=MyServerIP;Port=5480;Database=MyDBName;Uid=MyID;Pwd=myPWD;ReadOnly=true;";
using (OdbcConnection conn = new OdbcConnection(connstring))
{
conn.ConnectionTimeout = 120;
conn.Open(); // error 08001
Console.WriteLine("OK");
}
I got:
An unhandled exception of type System.Data.Odbc.OdbcException occurred in System.Data.dll

Additional information: ERROR [08001] Client unable to establish connection


From https://msdn.microsoft.com/en-us/library/ms715433%28v=vs.85%29.aspx, I see that error 08001 is

The driver was unable to establish a connection with the data source.

From control panel --> adm tools --> Data Sources (ODBC), I checked that I have installed NetezzaSQL 7.01.00.3553

It should be 64 bits, because in Data Sources (ODBC -32 bit) there is another NetezzaSQL driver.

in C:\Windows\SysWOW64 I have nsqlodbc.dll, odbc32.dll and other related files.

My C# code is built for Any CPU. No matter I changed the build to 64 or 32 bits, I got the same error. It seems that C# code cannot find the driver ?

I can access the same server and DB from IBM Netezza Aginity workbench with the same ID and password without any problems.

Also, I can access the same server and database with same Uid and Pwd from the "server explorer" in same VS2013 on same machine. But, why I cannot access it from C# code ? In "server explorer", I right-clicked the connected server and in "Modify Connection" window, I copied the "use connection string" into my C# code. But, it does not work and got the same error !


Any ideas ?

Thanks

Continue reading...
 
Back
Top