on 2012 Aug 22 5:09 AM
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?
Request clarification before answering.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
60 | |
10 | |
8 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.