Forums Register Login

Howto: validate classpath specified by user when doing test connection

+Pie Number of slices to send: Send
Hi All,

I need to do a test connection when the user has specfied username, passwros, url etc. While using this i can test the connection but
can someone please tell me how can i validate the CLASSPATH also entered by the user. Can i possibly temorarily set the classpath to what user has specified and test the connection?

Please help!

Thanks in advance.

Sunil.

[removed urgent from subject]
[ July 22, 2005: Message edited by: Jeanne Boyarsky ]
+Pie Number of slices to send: Send
First: EaseUp.

I am guessing you need to know if the driver class you are letting the user define is in the classpath so they can connect using the JDBC URL you also let them supply? In which case there are methods available in java.lang.ClassLoader - if you can load a class it is on the classpath. Alternatively you could get the classpath from the System properties and use java.io.* to see if the files named in the classpath exist (assuming the user explicitly includes a jar file rather thna just a directory).

You can't set the classpath at runtime, but you can use a URLClassLoader to load jars and classes at runtime, which amounts to the same thing.
[ July 22, 2005: Message edited by: Paul Sturrock ]
Create symphonies in seed and soil. For this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 988 times.
Similar Threads
can any one help me in finding wrong answers
Desktop App and DataSource Connection Settings
Server Host/Port Validation
Student File and Checking Validity of DOB and Student ID
Setting classpath to test connection to database
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 00:43:45.