Hi Friends,
I have a very basic question in
JDBC. I am trying to connect to the database using JDBC.
Query:
Connection con = DriverManager.getConnection("url", "username", "password");
As per the documentation -> If successful then it returns the connection. If not then it gives an SQLException.
Please do let me know how should i check whether I have successfully got the connection to the database or not in my
Java program ?
Could I check like this
if(con != null)
out.println("Successfully received the connection ");
else
out.println("Could not get the connection ....");
Thanks and Regards,
Sid