How do I give a database path to ODBC Microsoft Access Driver with ampersand in it?

81 Views Asked by At

My database path name has an ampersand in it. "...\mthly calcs & projections...".

Unfortunately, the path name cannot be changed. How do I deal with this case? Is there a way to specify the database path to the driver so it accepts the path with an ampersand? Maybe escaping it somehow or encoding it differently?

In the connection string if I use "&" doesn't work because ";" is interpreted as an option delimiter.

"jdbc:easysoft:mdb?DBQ=...\\mthly calcs & projections\\...\\Databases\\myDatabase.accdb;ExtendedAnsiSQL=1;READONLY=False;EXCLUSIVE=True"

I tested it by changing the path name by replacing the "&" with "and" and it works fine. Unfortunately in the production version the path names are fixed and I can't change them to remove the "&".

1

There are 1 best solutions below

2
Gustav On

Escaping the ampersand should work:

"jdbc:easysoft:mdb?DBQ=...\\mthly calcs \& projections\\...\\Databases\\myDatabase.accdb;ExtendedAnsiSQL=1;READONLY=False;EXCLUSIVE=True"