Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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?

asked 22 Aug '12, 04:09

Dan%20Cleyne's gravatar image

Dan Cleyne
486101627
accept rate: 25%


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.

permanent link

answered 22 Aug '12, 09:15

Ian%20McHardy's gravatar image

Ian McHardy
3.4k23557
accept rate: 40%

edited 22 Aug '12, 09:17

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

(22 Aug '12, 19:11) Dan Cleyne
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×19

question asked: 22 Aug '12, 04:09

question was seen: 2,907 times

last updated: 22 Aug '12, 19:11