cancel
Showing results for 
Search instead for 
Did you mean: 

semi-colon in database filename

Former Member
3,192

We have a database file which has a semicolon in its filename, and we're trying to open the file by specifying a DBF value in a connection string (for example, via Interactive SQL's "connect with a connection string" interface), but the semicolon seems to be being treated as an argument delimiter, even when embedded inside a double-quoted string. Is there a correct way to escape the semicolon so that we can open the file via a connection string?

Accepted Solutions (1)

Accepted Solutions (1)

ian_mchardy
Product and Topic Expert
Product and Topic Expert

Using semicolons (;) as part of values that are specified as part of connection string values is not recommended and not supported. Is it possible for you to rename your file or prevent users from including semicolons in the database filename if they choose the filename? That is the recommended solution. If not then is it possible to start the server manually before the connecting to it? For example dbeng12 "a;b.db" -n ab (note that the server does not allow semicolons in the database alias or the server name).

I know that the Microsoft ODBC driver manager does not support semicolons, and semicolons in connection parameter values are not specifically supported by most client applications (including dbisql), which will result in semicolons causing connection failures. You may be able to workaround these by putting single or double quotes around the DBF connection parameter value. In order to escape quotes within a quoted string you need to double them. So for example, the following worked for me (including autostarting the server and database):

dbisql -c "uid=dba;pwd=sql;dbf='''a;b.db''';dbn=a"

But this is not supported or recommended. Use at your own risk.

Former Member
0 Kudos

Thanks Ian,

We run SQL Anywhere as an embedded backend and so these filenames are being chosen by the user. I'll use your answer to go back to the BAs and continue the discussion about restricting the available characters in filenames...

Cheers, Dan

Answers (0)