Hi,
There's a strange issue we're facing with connections retrieved from
the Sybase implementation of the datasource (JConnect).
We need to have the url of the connection which we can find in
SybConnection.getMetaData().getURL().
The url is present when the connection is created using:
DriverManager.getConnection(url,username, password)
However when we create a SybDataSource
(com.sybase.jdbc3.jdbc.SybDataSource) the connections that are
provided don't have the url in the MetaData.
This is how I create the DataSource:
SybDataSource ds = new com.sybase.jdbc3.jdbc.SybDataSource();
ds.setUser(login);
ds.setPassword(password);
ds.setConnectionProperties(someProperties); //
ds.setServerName(serverHost);
ds.setPortNumber(serverPort);
Connection c = ds.getConnection();
but c. getMetaData().getURL() is null
Could someone please indicate me how to have the connection to have
the url in the MetaData ?
Is there a specific properties to set within the
ConnectionProperties ?
Many thanks and regards,
Michael
It seems correct at first blush... When you obtain a connection
from a DataSource, you have given no URL, so the metadata
is accurate. If there is a setURL() method on the DataSource,
use it and see if getURL() returns what you gave. Otherwise,
what info is there in the URL besides the stuff you gave in
other calls, such as the server name and port? Is it that you
want the server name and port from the connection?
Joe
Yes that's it.
My purpose is to distinguish among SybConnections from which database
server they are refering to without having to issue any sql on the
connection so "select @@servername " or something like this.
public String getServerName()
public int getPortNumber()
public String getSERVICENAME()
public String getHOSTNAME()
public String getHOSTPROC()
HTH,
Joe Weinstein at Oracle