Given a DataSource object, I want to retrieve certain properties such as databasename, servername, port, etc. That is, info reflected in the connection-url.
I am using Sybase with JBoss 4.01 and the relevant portions of my sybase-ds.xml are:
My sybase driver is jconn2d.jar
In my code I am getting a connection this way:
Context objContext = new javax.naming.InitialContext();
DataSource ds = (DataSource) objContext.lookup("java:sybDS");
con = ds.getConnection();
It all works fine, except I do not know how to extract the various properties of the datasource object. I want to use the URL information for certain display purposes in my app.
The basic DataSource interface does not appear to have these methods, while the SybDataSource interface does have them. Is there a way to instantiate and work with a SybDataSource instead??
I've done a lot of searching but could not find the answer but I'm also relatively new and may well be missing some obvious concepts.
Thanks for any input,
Use JMX, the jboss.jca domain