Can't connect to database when the servername has a backslash in it
Show older comments
I am using JDBC to connect to various databases, and as whole everything is working incredibly smooth - However, there is another database located on a server where the servername is something like "PART1\PARTB", when I use this as the servername, the backslash is used as an escape character, and there is a message given as:
"JDBC Driver Error: The TCP/IP connection to the host PART1, port x has failed etc."
This however works for every other database and server, and works on other applications.
The code I use to connect, which I have changed some of the name is:
conn = database('DB1','','','Vendor','Microsoft SQL Server', ...
'Server','PART1\PART2','AuthType','Windows');
Can anyone help me figure out what the issue is here, and what the workaround/fix for this is?
Thanks
Accepted Answer
More Answers (1)
Jon
on 27 Jun 2023
0 votes
There may be a much cleaner way to deal with this. I'm not sure of the details of why you get this error. Are you on a windows machine? If so you can map your network drive and then just use the mapped drive location without the slashes
1 Comment
James McBrearty
on 28 Jun 2023
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!