0

Running mysql Ver 15.1 Distrib 5.5.44-MariaDB, for Linux (x86_64) using readline 5.1

I have written a Java servlet which runs executeUpdate() on an SQL export statement and returns integer value.

    String sql = "SELECT TRIM(CONCAT( field1, CallDate, field2, Minutes, field3, field4 )) INTO OUTFILE '/var/www/html/pld/CDROUT/test2.txt' LINES TERMINATED BY '\n' FROM CDRLEC";
    Statement s = dbConPLD.createStatement();
    int rows = s.executeUpdate(sql);
    // Returns number of rows affected by this process
    return (rows == 0) ? 0 : rows;

    // Then, in the calling servlet, I have this        
    String returnOutput = Integer.toString(rows);
    return returnOutput;

This works fine with small tables of just a few thousand rows. When I run this on a table with 40,000 rows (40,895 to be exact), I get a large negative number: -24641. Same results when I execute an import statement. The file is 14MB.

Also the same result when I delete all the imported recods from the table: "delete from CDRLEC". I get -24641 rows processed.

The export and import are successfully executed. It's just that instead of seeing 40895 I see -24641 for rows. Can someone help me figure out what the heck is going on?

1 Answer 1

0

I was using the JDBC Driver:MariaDB connector/J 1.4.2

I resolved the issue by switching to: JDBC Driver:MySQL-AB JDBC Driver mysql-connector-java-3.0.17-ga

Code works as expected now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.