I am attempting to connect to an SQL Anywhere 12 database via VB.NET VS2008.
When attempting to use connection string setting different parameters I get an "Invalid User ID or password". Yet the User id and password is correct.
If I set the connection string with a DSN= it works fine.
I am using the SAConnectionStringBuilder.
enter code here
Public Shared Function GetActiveConnection(ByVal hostName As String, ByVal serverName As String, ByVal databaseName As String, ByVal userName As String, ByVal password As String, ByVal authentication As String) As SAConnection
Dim connBuilder As New SAConnectionStringBuilder
connBuilder.Host = hostName
connBuilder.ServerName = serverName
connBuilder.DatabaseName = databaseName
connBuilder.Integrated = "False"
connBuilder.UserID = userName
connBuilder.Password = password
connBuilder.ConnectionTimeout = 60
Return New SAConnection(connBuilder.ConnectionString)
End Function
Public Shared Function BuildConnectionString(ByVal hostName As String, ByVal serverName As String, ByVal databaseName As String, ByVal userName As String, ByVal password As String, ByVal authenticationMode As String) As String
Return GetActiveConnection(hostName, serverName, databaseName, userName, password, authenticationMode).ConnectionString.ToString
End Function
Public Shared Function ConnectStringOK(ByRef ConnectString As String) As Boolean
Try
Dim cConnect As String = ConnectString
Dim sqlC As New SAConnection(cConnect)
sqlC.Open()
sqlC.Close()
Return True
Catch ex As Exception
Return False
End Try
The connect string is constructed as: "UserID=dba;DatabaseName=NTTest;ServerName=TSTSyb12;Integrated=False;Connection Timeout=60;Host=SVR"
It appears the Error source is "SQL Anywhere .NET Data Provider", with "Invalid USer ID or password"
Any ideas?
asked
04 Nov '14, 01:39
KGINOZZ
50●2●2●6
accept rate:
0%
Hard to tell without more details - but might there be the PWD value missing in the last line ("The connect string is...")?