Exception in thread "main" java.lang.NullPointerException
Hai,
When i complie the program it complied fine and when running my program i am getting this error.
basically ,
my code here is
public static void main (String args[])throws SQLException
{
String driverName = "com.mysql.jdbc.Driver";
String connectURL = "jdbc:mysql://localhost:3306/bhargavi";
Connection db = null;
try {
Class.forName(driverName);//Load the driver
db = DriverManager.getConnection(connectURL,"root","");//Establish the connection
Statement statement = db.createStatement();
--some select queries--
} catch (Exception e) {
System.err.println("Error creating class: "+e.getMessage());
} //end of try catch
finally {
System.out.println("Closing connections...");
try {
db.close();//closing the Database Connection.
} catch (SQLException e) {
System.err.println("Can't close connection");//Print the Error if database connection is not closed
}
can any one help me in tracing my problem
g

