exception is never thrown in body of try statement
part of my program is this
import java.sql.*;
import javax.naming.*;
import java.util.*;
public void dbConnection()
{
try
{
Class.forName("com.mysql.jdbc.Driver");
m_connection=DriverManager.getConnection("jdbc:mys ql://localhost/libsoft","root","test");
}
catch (SQLException se)
{
System.out.println("SQL Error while connecting to the database : "+
se.toString());
}
catch (NamingException ne)
{
System.out.println("Naming exception Error while connecting to the database : "+ ne.toString());
}
catch (Exception e)
{
System.out.println("Other Error while connecting to the database : "+
e.toString());
}
}
when I compile this one error shows me.
exception javax.naming.NamingException is never thrown in body of corresponding try statement
catch (NamingException ne)
^
1 error
Please help me..
|