Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SybConnection.getMetaData().getUrl is null

70 views
Skip to first unread message

Michael

unread,
Feb 22, 2010, 11:53:28 AM2/22/10
to Neal....@sybase.com, jay.an...@sybase.com
Using JConnect version: JConn3-6.05.16903 and Sybase 15

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

joe.we...@gmail.com

unread,
Feb 23, 2010, 10:29:57 AM2/23/10
to
Hi.

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

Michael

unread,
Feb 23, 2010, 2:01:38 PM2/23/10
to
On Feb 23, 4:29 pm, "joeNOS...@bea.com" <joe.weinst...@gmail.com>
wrote:

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.

joe.we...@gmail.com

unread,
Feb 23, 2010, 4:03:13 PM2/23/10
to

Hi, unfortunately the sybase driver doesn't have any getters that will
return that info from the connection or it's metadata. The DataSource
does:

public String getServerName()
public int getPortNumber()
public String getSERVICENAME()
public String getHOSTNAME()
public String getHOSTPROC()

HTH,
Joe Weinstein at Oracle

0 new messages