0

Am working on anypoint studio 6.6.8 with runtime 3.9.4EE. I have the following mssql generic database connection string.

jdbc:sqlserver://ABC.org:59000;databaseName=master;username=nrp;password=*37n%3b#wu;5r:;_1z~(f{1y{j

Test connection gives me the following error:

Test connection failed:
org.mule.module.db.internal.domain.connection.ConnectionCreationException: Cannot get connection for URL jdbc:sqlserver://ABC.org:59000;databaseName=master;username=nrp;password=<<credentials>>;5r:;_1z~(f{1y{j: The connection string contains a badly formed name or value

PS: I have 2 semi colons in password

I have seen similar question raised here earlier a few times, hence my question might look repetitive. however I tried the following solutions given in the replies. none of them worked. Please let me know if you have any alternate solution.

  1. Enclosing the password in single quotes.
  2. adding \ in front of ;
  3. Enclosing password within double quotes or {}
  4. Am not the admin hence removing ; from password cannot be done.
aled
  • 21,330
  • 3
  • 27
  • 34
Neer
  • 31
  • 7

2 Answers2

1

The connection string is in a format known as JAVA JDBC URL. It is similar to a normal URL. Many characters are not allowed in URLs and have to be encoded with the URL encoding method. Try using URL encoding for the entire URL. You can do it with most languages or online pages, though you might want to avoid public pages for sensitive information like passwords.

aled
  • 21,330
  • 3
  • 27
  • 34
0

Thank you @aled

So the {} did work. I was doing it the wrong way. I was encrypting the password & later concatenating {} to the decrypted password right b4 passing the connection string.

What worked was that I enclosed the password in {} first & then encrypted it.

Neer
  • 31
  • 7