在vb.net控制台应用程序(x64)上使用odbc connector(x64)连接到postgresql数据库时遇到问题,错误, http://www.sumarlidason.com/tmp/120312/odbc_capture1.png
Dim ConnectionString = "Driver={PostgreSQL UNICODE};Server=myPGSrv;Port=5432;Database=dbDefault;Uid=postgres;Pwd=pw;"
'Dim ConnectionString = "ODBC;dsn=PostgreSQL35W"
conn = New OdbcConnection(ConnectionString)
'Open connection to an instance of the PostgreSQL database.
Try
conn.Open()
Catch Ex As Exception
MsgBox(Ex.Message)
End Try
Dim commonOdbcCommand = New OdbcCommand
commonOdbcCommand.Connection = conn
conn.Close()
另外,我在控制面板中配置了数据库,请看这里.. http://sumarlidason.com/tmp/120312/odbc_capture.png
答案 0 :(得分:0)
正确的连接字符串:
Dim conn As New OdbcConnection("DSN=PostgreSQL35W")