JDBC connection reset when querying SQL server

Viewed 427

I am trying to insert data into my MS Server database using the jdbc libraries. I am successfully able to insert (and select) smaller queries, but as soon as I try a larger insert I get the following error:

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)

When I run the query from Azure Data Studio, it runs just fine with no errors. Is there a limit in the JDBC for the length of the query?

This is the method that executes the query.

public void executeQuery(String query){
        try{
            PreparedStatement stmt = CONN().prepareStatement(query);
            stmt.execute();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

Thanks in advance!

NOTE: I am successfully able to connect to the DB

0 Answers
Related