从Visual Studio 2012访问Netezza SQL数据库时出错

时间:2022-02-03 10:07:50

Although the similar questions had been asked here many times, this question occurred in environment different from others.

虽然这里曾多次提出类似的问题,但这个问题出现在与其他问题不同的环境中。

From Visual studio 2012 professional, when I accessed database by NetezzaSQL driver (through C# code), i got error:" Data source name not found and no default driver specified".

从Visual Studio 2012专业版,当我通过NetezzaSQL驱动程序访问数据库(通过C#代码)时,我收到错误:“未找到数据源名称且未指定默认驱动程序”。

My desktop is 64bit win7 and the connection string is

我的桌面是64位win7,连接字符串是

  Driver={NetezzaSQL};Server=xxxxxxxxxx;Database=myTool;Uid=myUser;Pwd=myWord;ReadOnly=false;"

I found that we have NetezzaSQL driver for ODBC(64 bit) but we do not have ODBC (should be 32 bit) driver.

我发现我们有ODBC(64位)的NetezzaSQL驱动程序,但我们没有ODBC(应该是32位)驱动程序。

If I change the build property target platform as any CPU, I got the above error.

如果我将构建属性目标平台更改为任何CPU,我得到上述错误。

If I change the build property target platform as x64, I got error "remote endpoint was not reachable."

如果我将构建属性目标平台更改为x64,则出现“远程端点无法访问”的错误。

I can access the database from Aginity netezza workbench with the same above connection string without any problems from my desktop.

我可以使用相同的上述连接字符串从Aginity netezza workbench访问数据库,而我的桌面没有任何问题。

Any help would be appreciated.

任何帮助,将不胜感激。

1 个解决方案

#1


1  

I use a connection that is slightly different, making sure to include the System.Data.Odbc namespace and I can connect fine. VS2012

我使用稍微不同的连接,确保包含System.Data.Odbc命名空间,我可以很好地连接。 VS2012

"Driver=NetezzaSQL; Server=xx.xxx.xx.xxxx; Port=5480; Database=dbname; Persist Security Info=true; UID=username; PWD=pword"

#1


1  

I use a connection that is slightly different, making sure to include the System.Data.Odbc namespace and I can connect fine. VS2012

我使用稍微不同的连接,确保包含System.Data.Odbc命名空间,我可以很好地连接。 VS2012

"Driver=NetezzaSQL; Server=xx.xxx.xx.xxxx; Port=5480; Database=dbname; Persist Security Info=true; UID=username; PWD=pword"