查询SQL server时重置java JDBC连接
我正在尝试使用jdbc库将数据插入MS Server数据库。 我能够成功地插入(并选择)较小的查询,但一旦我尝试较大的插入,就会出现以下错误:
W/System.err: java.sql.SQLException: I/O Error: Connection reset
at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1053)
W/System.err: at net.sourceforge.jtds.jdbc.TdsCore.microsoftPrepare(TdsCore.java:1179)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareSQL(ConnectionJDBC2.java:679)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.execute(JtdsPreparedStatement.java:557)
当我从Azure Data Studio运行查询时,它运行得很好,没有错误。JDBC中对查询的长度有限制吗
这是执行查询的方法
public void executeQuery(String query){
try{
PreparedStatement stmt = CONN().prepareStatement(query);
stmt.execute();
} catch (SQLException e) {
e.printStackTrace();
}
}
提前谢谢
注意:我已成功连接到数据库
共 (0) 个答案