One Star

Invalid Escape character in connnection string

I'm using jodbc to connect to my SQL Server db. For brevity I have to use this type of connection. Our sql server has an instance name besides default.
My connection string is:
"jdbc:sqlserver://10.1.0.34\CLSDev;databaseName=CNTLAND_LMSLINK_TALENDTEST";
which Checks and works (I'm able to connect and load table schema).
Howerver when I run my job I keep getting the following error:
Invalide escape sequence (following are valid....)
I'm looking at the code and it errors on the following:
String url_tJDBCConnection_1 = "jdbc:sqlserver://10.1.0.34\CLSDev;databaseName=CNTLAND_LMSLINK_TALENDTEST";
How do I get to use the instance name but keep the "invalid escape character"?
thanks!
5 REPLIES
One Star

Re: Invalid Escape character in connnection string

In additional parameters set instance=instancename eg instance=CLSDev
Seven Stars

Re: Invalid Escape character in connnection string

Try doubling the backslash in the connection string since that is an escape character for Java.
One Star

Re: Invalid Escape character in connnection string

Hi,
1. I don't see where I can set additional parameters, there is no box for that.
2. I tried the double back slash and it doesn't work.
any other thoughts?
-Leon
Community Manager

Re: Invalid Escape character in connnection string

Hi,
1. I don't see where I can set additional parameters, there is no box for that.
2. I tried the double back slash and it doesn't work.
any other thoughts?
-Leon

The additional parameters text is not available in tJDBCxxx component. Double backslash should be ok, I tested and it don't have compilation error.
"jdbc:sqlserver://10.1.0.34\\CLSDev;databaseName=CNTLAND_LMSLINK_TALENDTEST"
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Invalid Escape character in connnection string

I am facing the same problem when I try to connect to my defualt instance that is 192.168.6.46 it works fine
But when I use connectionstring as jdbc:jtds:sqlserver://192.168.6.46//test:1433/databaseName=bd_ip;
I get an error as login failed for User sa

Please help