大家帮我看看这小段代码那里错了啊?????????
public class SqlBean {
public static synchronized Connection getConnection() throws Exception{
try{
Class.forName(DB_DRIVER).newInstance(); //常量定义过了
String url =DB_CONNSTRE;
String username = "sa";
String password = "sa";
Connection con = DriverManager.getConnection(url,username,password);
return con;
}catch(SQLException e){
System.out.println(e);
throw e;
}
}
public void executeInsert(String sql)
{
try
{
Statement stmt = this.getConnection().createStatement();
stmt.executeUpdate(sql);
}
catch(SQLException ex)
{
System.out.print("执行插入有错误" + ex.getMessage());
}
}
}
Statement stmt = this.getConnection().createStatement(); 这提示我“未处理的异常类型Exception”