java.lang.NullPointer.Exception错误
编译通过,运行出现这个错误
import java.sql.*;
public class conn
{
private String driver= "sun.jdbc.odbc.JdbcOdbcDriver ";
private String url= "jdbc:odbc:huang ";//
private String user= "abc ";
private String password= "123 ";//softrunhnccc
private Connection conn=null;
private ResultSet rs=null;
private Statement stmt=null;
public conn()
{
try
{
Class.forName(driver);
try {
conn = DriverManager.getConnection(url, user, password);
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
}
catch (
SQLException ex) {
System.out.println(ex.getMessage());
}
}
catch(
java.lang.ClassNotFoundException e)
{
System.err.println( "Class Loading Exception: "+e.getMessage());
}
}
public ResultSet executeQuery(String sql) //query
{
try
{
rs=stmt.executeQuery(sql);
}
catch(SQLException ex)
{
System.err.println( "Query Exception: "+ex.getMessage());