这道题应该怎么分析并改正错误呢?
分析程序并改错:谢谢大家!
public void open(String iJND)
{
Context context = new InitialContext();
DataSource dataSource = (DataSource)context.lookup(iJNDI);
connection = dataSource.getConnection();
stmt =
connection.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE,Result.CONCUR_UPDATABLE);
connection.close();
}
------解决方案--------------------你这个方法是不是要用来打开链接的啊??
如果是的怎么又关了连接啊??
connection.close();
------解决方案-------------------- public void open(String iJND)throws Exception
{
Context context = new InitialContext();
DataSource dataSource = (DataSource)context.lookup(iJND);
java.sql.Connection connection = dataSource.getConnection();
Statement stmt = connection.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
connection.close();
}