长江e号登录显示java.sql.sqlexceptionanattemptbyac

黄琴知 2019-12-21 20:03:00

推荐回答

没有提交事务try{Class.forNamedriverName;dbConn=DriverManager.getConnectiondbURL,userName,userPwd;dbConn.setAutoCommitfalse;//设成非自动提交System.out.println"ConnectionSuccessful!";Statementstat=dbConn.createStatement;StringtableName="SC";ResultSetrs=stat.executeQuery"SELECT*FROM"+tableName;Stringsql3="deletefromSC";PreparedStatementpst=dbConn.prepareStatementsql3;pst.executeUpdate;StringstuID="";StringcourseId="";Stringscore="";whilers.next{stuID=rs.getString"stuID";courseId=rs.getString"courseId";score=rs.getString"score";System.out.printlnstuID+""+courseId+""+score;}dbConn.commit;//手动提交事务rs.close;stat.close;dbConn.close;}catchExceptione{e.printStackTrace;}}。
龙宣霖2019-12-21 20:06:24

提示您:回答为网友贡献,仅供参考。

相关问答