Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

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's gravatar image

accept rate: 0%

edited 04 Nov '14, 03:47

Reimer%20Pods's gravatar image

Reimer Pods

Hard to tell without more details - but might there be the PWD value missing in the last line ("The connect string is...")?

(04 Nov '14, 03:56) Volker Barth

Add this to GetActiveConnection:

connBuilder.PersistSecurityInfo = True

This will permit the password to be passed around.

permanent link

answered 04 Nov '14, 15:28

JBSchueler's gravatar image

accept rate: 20%

Thanks JB,

That was the answer.


(04 Nov '14, 17:17) KGINOZZ
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 04 Nov '14, 01:39

question was seen: 1,929 times

last updated: 04 Nov '14, 17:17