0

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 "&".

user13892
  • 267
  • 4
  • 12
  • Asked this question in the [comment](https://stackoverflow.com/questions/26244425/general-error-unable-to-open-registry-key-temporary-volatile-from-access) of an older question but no response. – user13892 Dec 26 '22 at 02:49
  • Try `mthly calcs %26 projections` or possibly `mthly+calcs+%26+projections` – Gord Thompson Dec 26 '22 at 04:29
  • if you are connecting from Access try using the character code for &. "\\mthly calcs " & char(38) & "projections\\" if you are connecting from elsewhere try finding the equivalent for the vba function char() – mazoula Dec 26 '22 at 06:10
  • @GordThompson Tried `%26` for `&`. @mazoula Tried `FromCharacterCode[38]` also doesn't work. `38` is just the character code for `&` so it produces the same connection string. – user13892 Dec 27 '22 at 02:36

1 Answers1

0

Escaping the ampersand should work:

"jdbc:easysoft:mdb?DBQ=...\\mthly calcs \& projections\\...\\Databases\\myDatabase.accdb;ExtendedAnsiSQL=1;READONLY=False;EXCLUSIVE=True"
Gustav
  • 53,498
  • 7
  • 29
  • 55