这个错究竟是不是就是DBVisit.conn里面的错误啊?可是我找不到里面有什么错
public class DBConn {
private static Connection conn=null;
private static ResultSet st=null;
private static PreparedStatement rs=null;
static String driverName=null;
static String dbURL=null;
static String userName=null;
static String password=null;
static
{
try{
DBConn.class.getClassLoader();
//读取接口文件内的信息
InputStream in=ClassLoader.getSystemResourceAsStream("joggle.properties");
Properties prop=new Properties();
prop.load(in);
driverName=prop.getProperty("driverName");//获取连接驱动
dbURL=prop.getProperty("dbURL");//获取端口口地址
userName=prop.getProperty("userName");//获取登录数据库时的名字
password=prop.getProperty("userPwd");//获取数据库身份验证的密码
Class.forName(driverName);//加载驱动
}catch(Exception e)
{
throw new ExceptionInInitializerError(e);
}
}
public static Connection getConnection() throws SQLException //连接数据库
{
return DriverManager.getConnection(dbURL, userName, password);
}
public static void release(Connection conn,Statement st,ResultSet rs )//释放数据库资源
{
if(rs!=null)
{
try
{
rs.close();
}catch(Exception e)
{
e.printStackTrace();
}
rs=null;
}
if(st!=null)
{
try
{
st.close();
}catch(Exception e)
{
e.printStackTrace();
}
}
if(conn!=null)
{
try{
conn.close();
}catch(Exception e)
{
e.printStackTrace();
}
}
}
}