7 messages in com.mysql.lists.javaRe: Invalid data coming from JDBC driver
FromSent OnAttachments
Marc Dumontier21 Apr 2004 13:58 
Marc Dumontier21 Apr 2004 21:37 
Gary Byatt21 Apr 2004 23:30 
Marc Dumontier22 Apr 2004 06:30 
Mark Matthews22 Apr 2004 06:51 
Marc Dumontier22 Apr 2004 08:07 
Mark Matthews22 Apr 2004 08:23 
Subject:Re: Invalid data coming from JDBC driver
From:Marc Dumontier (mrdu@blueprint.org)
Date:04/22/2004 08:07:32 AM
List:com.mysql.lists.java

Hi Gary,

The column type is longtext.

Remember that I can pull out the 19MB record ok using the mysql client. This bug only seems to exist in the JDBC driver.

I have my max_allowed_packet set high in my my.cnf for the server, and client. Is there any settings for this in the JDBC driver?

Marc

Hi Marc

Is colum 'XMLRecord' a mediumblob or mediumtext field; they have 16MB limits ~ change to longblob or longtext. Use the communication packet length startup option e.g. 'mysqld -O max_allowed_packet=50M' ~ the default is 16MB.

good luck gary

----- Original Message ----- From: "Marc Dumontier" <mrdu@blueprint.org> To: "Marc Dumontier" <mrdu@blueprint.org>; <ja@lists.mysql.com> Sent: Thursday, April 22, 2004 5:37 AM Subject: Re: Invalid data coming from JDBC driver

Hi,

Here's an update

If i insert in a document which is 16MB-1 bytes, retrieval is ok If i insert in a document which is 16MB+1 bytes, retrieval is not ok If i insert in a document which is 16MB, an exception is thrown during retrieval

java.sql.SQLException: null: at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:725) at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:279) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1001) at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:928) at com.mysql.jdbc.Connection.execSQL(Connection.java:1871) at com.mysql.jdbc.Connection.execSQL(Connection.java:1805) at com.mysql.jdbc.Statement.executeQuery(Statement.java:1143) at org.blueprint.common.db.DbManager.executeQuery(DbManager.java:428) at FetchFromDb.main(FetchFromDb.java:21) Exception in thread "main" java.lang.NullPointerException at FetchFromDb.main(FetchFromDb.java:22)

Hope this helps

-- Marc Dumontier Bioinformatics Software Developer The Blueprint Initiative - North America 522 University Ave. Toronto, Ontario, Canada M5G 1W7 http://www.blueprint.org

----- Original Message ----- From: "Marc Dumontier" <mrdu@blueprint.org> To: <ja@lists.mysql.com> Sent: Wednesday, April 21, 2004 4:58 PM Subject: Invalid data coming from JDBC driver

Hi,

I have a record which is 'large'. It's about 20MB of XML data. I can get it properly using the mysql client program

echo "SELECT XMLRecord from BINDSubmit" | mysql -u xxx -p xxx

BINDSubmit

record.xml

When i try to SELECT it out using the JDBC Driver (version 3.0.8) I get the following data back. It's basically the record, with 4 null characters are the start, and 4 characters missing from the end.

If I run the same program using the alpha development driver (version 3.1.1), I'm missing 4 characters from the start, and 4 null characters are appended to the end.

I have mysql server 4.0.12 on Redhat Linux 9.0 (2.6 kernel) , i386

program is: NOTE: DbManager is just a wrapper for a Connection object.

import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.PrintStream; import java.sql.Clob; import java.sql.ResultSet;

public class FetchFromDb {

public static void main(String[] args) throws Exception { PrintStream out = new PrintStream(new FileOutputStream("out.xml")); DbManager manager = new DbManager("com.mysql.jdbc.Driver",

"jdbc:mysql://localhost/BINDSubmit?user=username_goes_here&password=password

_goes_here&autoReconnect=true");

manager.connect();

ResultSet rs = manager.executeQuery("select XMLRecord from BINDSubmit"); rs.first(); Clob clob = rs.getClob("XMLRecord");

BufferedReader reader = new BufferedReader(clob.getCharacterStream()); String line = null; while( (line = reader.readLine()) != null) { out.println(line); } out.flush();

rs.close(); manager.disconnect(); }

You can get the mysqldump of the row @ ftp://ftp.blueprint.org/mysql BINDSubmit.mysqldump.gz (about 0.4MB )

I'd appreciate any help or insight on this problem.

Thanks in advance, Marc