How can i use threads to connect to a database ?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sandhya_Haridas
Posted On:   Monday, October 15, 2001 03:04 AM

I want to use threads to connect to a database. If i am unable to connect to the DB...the thread should wait for 30 secs . After 30 secs...if the thread is still not able to connect to the DB...a message should be displayed saying that "Connection to the databse failed."
How do i do this ???

Re: How can i use threads to connect to a database ?

Posted By:   Anonymous  
Posted On:   Monday, October 15, 2001 03:26 AM

while starting the application create a new thread which has all
jdbc driver and connection related stuff. If it throws any exception
then catch the exception and use Thread.sleep() to wait for 30 seconds.
And again try to connect. Even if it fails now , show a dialog box with
the message you are interested and come out from the application. I
hope this solves your problem. If you need more info or in case of
any doubts let me know
About | Sitemap | Contact