4 messages in com.mysql.lists.javaRe: problem with setBinaryStream for ...| From | Sent On | Attachments |
|---|---|---|
| Mark Matthews | 27 Jun 2001 18:15 | |
| Emily Johnson | 27 Jun 2001 22:34 | |
| Tim Endres | 27 Jun 2001 23:11 | |
| Emily Johnson | 28 Jun 2001 19:12 |
| Subject: | Re: problem with setBinaryStream for MySQL![]() |
|---|---|
| From: | Emily Johnson (emil...@yahoo.com) |
| Date: | 06/28/2001 07:12:57 PM |
| List: | com.mysql.lists.java |
--- Emily Johnson <emil...@yahoo.com> wrote: Hello Tim,
Thanks for the reply.
I have looked through the documentation.... but no good results.
I tried increasing the "built-in limit", in this case, max_allowed_packet=24M, since I am trying to insert the binary file (108k) into a MEDIUMBLOB data field type. I could not change the value of max_allowed_packet to 24M from 1048576. I tried...
mysqld -O max_allowed_packet=24M
It seems to change to 24M, and then got change back to 1048576. How do I know that...
mysqld -O max_allowed_packet=24M --help > data.txt data.txt shows the value 24M. But, when I tried mysqld --help
the value at max_allowed_packet has changed back to 1048576. I tried the same thing on Win98. Still the same thing. On Windows, I even tried the my.cnf trick after > reading about it in the documentation. I wrote....
set-variable = max_allowed_packet=24M in the my.cnf file and position the file at C:\ A
strange thing happened when I restart the the mySQL server. The my.cnf file got renamed to my_cnf.bak. There is no other my.cnf file insight on C:\
After some more test on trying to read the file into mySQL, I noticed that I cannot insert a binary file larger that 61-62KBytes.
Would you have any suggestions or any more insights to what I am doing wrong here?
Thanks in advance.
Emily
--- Tim Endres <ti...@trustice.com> wrote:
I believe there is a built-in limit on the size of fields that the driver will transmit. The documentation should explain how to increase this limit. If I remember correctly, it was a property, I do not think you have to recompile.
tim.
Hello all,
I am having problem storing a binary file (103kBytes) into the database. I have NO problem when the binary file size is 2kBytes. The thing I do not understand is the data type that I have defined in the MySQL database is LONGBLOB... that should be more than enough to handle such a large binary file.
I am using MySQL server version: 3.23.36 on
linux
OS.
The error message I am getting is... java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at org.gjt.mm.mysql.Buffer.writeBytesNoNull (Buffer.java:352) at
org.gjt.mm.mysql.PreparedStatement.executeUpdate(PreparedStatement.java:291)
at Arch_SQL.tData_newData(Arch_SQL.java:155) at TestList.main(TestList.java:39)
Again... I do NOT have a problem when the file size is 2Kbytes. Is there something that I am missing here?
Has anyone encountered a similar problem. Any suggestions? Here is my a portion of my code to store the binary data into MySQL. Thanks in advance.
// bflag - binary data flag public void tData_newData(String typeid, java.sql.Timestamp timestamp, java.sql.Timestamp lasttimestamp, String filename, File file, String station, boolean bflag) {
int fileLength;
String stmt = "INSERT INTO data VALUES (null, ?, ?, ?, ?, ?, ? );";
try {
fileLength = (int)file.length();
InputStream fin = new FileInputStream(file); PreparedStatement pstmt = con.prepareStatement(stmt);
pstmt.setString(1, typeid); pstmt.setTimestamp(2, timestamp); pstmt.setTimestamp(3, lasttimestamp); pstmt.setString(4, filename);
if (bflag) {
pstmt.setBinaryStream(5, fin, fileLength);
} else {
pstmt.setAsciiStream(5, fin, fileLength);
}
pstmt.setString(6, station); pstmt.executeUpdate();
} catch (SQLException se) {
// Inform user of any SQL errors System.out.println("SQL Exception: " + se.getMessage()); se.printStackTrace();
} catch (IOException fe) {
System.out.println("File Exception: " + fe.getMessage());
} catch (ArrayIndexOutOfBoundsException ar) {
System.out.println("Array Index Out of Bound Exception: " + ar.getMessage()); ar.printStackTrace();
}
}
__________________________________________________
Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
---------------------------------------------------------------------
Please check
"http://www.mysql.com/Manual_chapter/manual_toc.html"
before
__________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
__________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/




