cancel
Showing results for 
Search instead for 
Did you mean: 

Escaping semicolons in DSN file

Former Member
0 Kudos
2,058

I am using DSN files with Adaptive Server Anywhere 17. I am having problems using the INITSTRING entry to authenticate the database. It appears that the embedded semicolon is terminating the necessary command and needs to be escaped. Here's (with authentication information removed) the DSN file entry:

INITSTRING=”SET TEMPORARY OPTION connection_authentication='Company=MyCompany;Application=MyApplication;Signature=aaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddeeeeeeeeeeeeefffff’;”
In the dbsrv17 logs, this is interpreted like this:
=,<,1,PREPARE,”SET TEMPORARY OPTION connection_authentication='Company=MyCompany
+5,E,1,-131,Syntax error near '”' on line 1
Clearly, the statement is truncating at the semicolon.

Does anyone know how I can restructure this DSN file entry do the statement is not truncated?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member

Figured it out. Surround the command with {} characters. For my example, the entry would be:

INITSTRING={SET TEMPORARY OPTION connection_authentication='Company=MyCompany;Application=MyApplication;Signature=aaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddeeeeeeeeeeeeefffff’;}

Breck_Carter
Participant
0 Kudos

It might also work if you had used the ordinary " characters instead of the funky ” characters... after all, that's what the error message said 🙂

VolkerBarth
Contributor
0 Kudos

Wild guess: The following relates to ODBC connection strings in .NET but does also explain the use of curly braces to escape particular chars...

OdbcConnection.ConnectionString Property