rodhoward / node-sybase

23 stars 55 forks source link

dbname doesn't work #27

Open BartVanBeurden opened 6 years ago

BartVanBeurden commented 6 years ago

The dbname parameter doesn't appear to be working on my SQL Anywhere 16 server.

I've never worked with jConnect before (or java for that matter), but according to the Sybase Reference the database name is supposed to be passed using the ServiceName parameter (see section "How to Specify a Database with a jConnect Connection String"). However, a quick look at the Source Code appears to indicate that you're building the connection string like this: host:port/dbname when it should be host: port?ServiceName=dbname

On a related note, I cannot find any documentation on how to switch to a different database (without creating a new connection, that is).

OscVicMedi commented 6 years ago

https://github.com/rodhoward/node-sybase/blob/master/JavaSybaseLink/src/SybaseDB.java

in line 58 change the url and compile again in .jar and manage to connect correctly to the database

conn = DriverManager.getConnection("jdbc:sybase:Tds:" + host + ":" + port + "?ServiceName=" + dbname, props); //jdbc:sybase:Tds:{host}:{port}?ServiceName={dbname}