JDBC retrieve the server name/ip from a java.sql.connection

D

dnasmars

Hi all,

is it possible to retrieve the server name or ip
from a Connection or a Statement
from the package java.sql.
thank you in advance
 
R

Roedy Green

is it possible to retrieve the server name or ip
from a Connection or a Statement
from the package java.sql.
thank you in advance

Try Driver.getPropertyInfo and dig around to see what is in there.
I gather you have already pawed through Connection.getMetaData

Perhaps you can get an URL and from that a name and from that an IP.

See http://mindprod.com/jgloss/uri.html
http://mindprod.com/jgloss/ip.html

Another approach is to save the url when you are constructing your
connect string rather than trying to extract it later.
 
D

dnasmars

Roedy said:
Try Driver.getPropertyInfo and dig around to see what is in there.
I gather you have already pawed through Connection.getMetaData

Perhaps you can get an URL and from that a name and from that an IP.

See http://mindprod.com/jgloss/uri.html
http://mindprod.com/jgloss/ip.html

Another approach is to save the url when you are constructing your
connect string rather than trying to extract it later.
thank you for the information I'll try
and will let you all know :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top