Re: blobs in mysql
I usually use ps.setBytes() and pass it a byte[] array .. On Wed, 22 Oct 2003, Scott Purcell wrote: > Hello, > I have opted to insert some small jpg files into the mysql database using java. > Code below. > > When I do a select from the table using the mysql> command line, it generates > pages of > --- > --- > which I guess is a visual of the blobed data. > > Anyway, I am used to Oracle I guess where it still shows the data, but shows a blob > in the column and not all the lines. > > Am I doing this wrong, or is this the way it is handled? > > Here is my code, the api showed using a prepared statement. It works, but the > selecting does not look proper. > > Thanks, > Scott > ### code below) > > Connection db = null; > PreparedStatement stmt = null; > ResultSet rs = null; > > try { > db = DriverManager.getConnection( > "jdbc:mysql://127.0.0.1:3306/menagerie", > "root", "x"); > > InputStream in = new FileInputStream(f); > > stmt = db.prepareStatement("insert into preview (username, theblob) > values (?, ?)"); > stmt.setString(1, "louie-louis"); > stmt.setBinaryStream(2, in, (int)f_length); > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
blobs in mysql
Hello, I have opted to insert some small jpg files into the mysql database using java. Code below. When I do a select from the table using the mysql> command line, it generates pages of --- --- which I guess is a visual of the blobed data. Anyway, I am used to Oracle I guess where it still shows the data, but shows a blob in the column and not all the lines. Am I doing this wrong, or is this the way it is handled? Here is my code, the api showed using a prepared statement. It works, but the selecting does not look proper. Thanks, Scott ### code below) Connection db = null; PreparedStatement stmt = null; ResultSet rs = null; try { db = DriverManager.getConnection( "jdbc:mysql://127.0.0.1:3306/menagerie", "root", "x"); InputStream in = new FileInputStream(f); stmt = db.prepareStatement("insert into preview (username, theblob) values (?, ?)"); stmt.setString(1, "louie-louis"); stmt.setBinaryStream(2, in, (int)f_length); -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Very large BLOBS in MySQL 4.0.1
> Adriano Manocchia wrote: > Well, first off, I can't seem to get max_allowed_packet higher than 64 > MB on the server using 3.23.x or 4.0.1. Changes made to /etc/my.cnf are > reflected in the system settings, but only up to 64 MB, then regardless > of what I put in there, it stays at 64 MB. But like I said, the file is > only 34 MB, so theoretically it shouldn't be a problem. As for the > client, I'm trying to insert the record with the Perl DBI, which, > according the documentation, uses the server's max_allowed_packet value. > There's no way to set it on the client side that I'm aware of. Hi, you might look for 4.0.2 (or 3.23.50) which contains some extra fix to take into account the size of the packet header when counting size of the whole packet. This affects you only if you cannot reimport mysqldump back into mysql, I used to get on 3.23.49a: $ mysqldump -O net_buffer_length=16M --extended-insert --add-drop-table Sulfolobus_solfataricus_P2 known3d | mysql -O net_buffer_length=16M mmo mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table 'known3d' at row: 106977 $ mysqldump -O net_buffer_length=16M --extended-insert --add-drop-table Sulfolobus_solfataricus_P2 known3d | mysql mmo mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table 'known3d' at row: 107088 $ mysqldump --extended-insert --add-drop-table Sulfolobus_solfataricus_P2 known3d | mysql mmo $ Look for subject "Re: --extended-insert breaks import of some tables through pipe" on similar thread in the bugs list. Note the last one succeeeds - this is a current workaround for me. " Martin MOKREJS wrote: > On Fri, 15 Mar 2002, Michael Widenius wrote: > > Martin> And if user sets net_buffer_length=80M, then happens what? Is it set just > > Martin> to 16M or is it ignored? This is what's not clear from docs. > > > > You can test this with: > > > > mysql -O net_buffer_length=80M --help > > > > In 4.0 it's set to about 80M, in 3.23 to 24 M (which was wrong, it > > should be 16M) > Yes, then please update the docs to say clearly that the value for net_buffer_length CAN be larger then 16M, although automatically it will grow only up to the value of max_allowed_packet. And mention the `mysql -O net_buffer_length=80M --help' example, that's nice. " Hope this helps Martin - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Very large BLOBS in MySQL 4.0.1
Well, first off, I can't seem to get max_allowed_packet higher than 64 MB on the server using 3.23.x or 4.0.1. Changes made to /etc/my.cnf are reflected in the system settings, but only up to 64 MB, then regardless of what I put in there, it stays at 64 MB. But like I said, the file is only 34 MB, so theoretically it shouldn't be a problem. As for the client, I'm trying to insert the record with the Perl DBI, which, according the documentation, uses the server's max_allowed_packet value. There's no way to set it on the client side that I'm aware of. On Saturday, March 30, 2002, at 12:11 PM, Peter Zaitsev wrote: > Hello Adriano, > > Friday, March 29, 2002, 11:38:32 PM, you wrote: > > As I remember there are max_allowed_packet options exists both for > client and server. You may wish to try to raise both of them. > > > AM> I've been using a perl script to insert a very large blob (up to > about 8 > AM> MB) into a DB successfully, but now I need to do it with a 34 MB > BLOB, > AM> so I upgraded to MySQL 4.0.1. First off, I can't get > AM> max_allowable_packet to go higher than 64M, regardless of what I > set it > AM> to, but that shouldn't be the problem, right? But I still keep > getting > > AM> DBD::mysql::st execute failed: MySQL server has gone away > > AM> when it tries to do the insert or update. It continues to work fine > for > AM> smaller files. The field is a longblob, BTW. Any help would be > greatly > AM> appreciated. And please don't tell me not to store large blobs in > the > AM> database. I wouldn't be doing it if I didn't have to. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Very large BLOBS in MySQL 4.0.1
Hello Adriano, Friday, March 29, 2002, 11:38:32 PM, you wrote: As I remember there are max_allowed_packet options exists both for client and server. You may wish to try to raise both of them. AM> I've been using a perl script to insert a very large blob (up to about 8 AM> MB) into a DB successfully, but now I need to do it with a 34 MB BLOB, AM> so I upgraded to MySQL 4.0.1. First off, I can't get AM> max_allowable_packet to go higher than 64M, regardless of what I set it AM> to, but that shouldn't be the problem, right? But I still keep getting AM> DBD::mysql::st execute failed: MySQL server has gone away AM> when it tries to do the insert or update. It continues to work fine for AM> smaller files. The field is a longblob, BTW. Any help would be greatly AM> appreciated. And please don't tell me not to store large blobs in the AM> database. I wouldn't be doing it if I didn't have to. -- Best regards, Petermailto:[EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Very large BLOBS in MySQL 4.0.1
It sounds to me that you're exceeding the maximum packet size mysql can handle. Adriano Manocchia wrote: > > I've been using a perl script to insert a very large blob (up to about 8 > MB) into a DB successfully, but now I need to do it with a 34 MB BLOB, > so I upgraded to MySQL 4.0.1. First off, I can't get > max_allowable_packet to go higher than 64M, regardless of what I set it > to, but that shouldn't be the problem, right? But I still keep getting > > DBD::mysql::st execute failed: MySQL server has gone away > > when it tries to do the insert or update. It continues to work fine for > smaller files. The field is a longblob, BTW. Any help would be greatly > appreciated. And please don't tell me not to store large blobs in the > database. I wouldn't be doing it if I didn't have to. > > Age > > --- > Adriano "Age" Manocchia [EMAIL PROTECTED] > Cornell University AIM/Yahoo/MSN: SalsaSharkNet > http://salsashark.net/ageICQ: 5962736 > --- > "The capacity to blunder slightly is the real marvel of DNA. > Without this special attribute, we would still be anaerobic > bacteria, and there would be no music." -Lewis Thomas > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- Colin Faber (303) 859-1491 fpsn.net, Inc. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Very large BLOBS in MySQL 4.0.1
I've been using a perl script to insert a very large blob (up to about 8 MB) into a DB successfully, but now I need to do it with a 34 MB BLOB, so I upgraded to MySQL 4.0.1. First off, I can't get max_allowable_packet to go higher than 64M, regardless of what I set it to, but that shouldn't be the problem, right? But I still keep getting DBD::mysql::st execute failed: MySQL server has gone away when it tries to do the insert or update. It continues to work fine for smaller files. The field is a longblob, BTW. Any help would be greatly appreciated. And please don't tell me not to store large blobs in the database. I wouldn't be doing it if I didn't have to. Age --- Adriano "Age" Manocchia [EMAIL PROTECTED] Cornell University AIM/Yahoo/MSN: SalsaSharkNet http://salsashark.net/ageICQ: 5962736 --- "The capacity to blunder slightly is the real marvel of DNA. Without this special attribute, we would still be anaerobic bacteria, and there would be no music." -Lewis Thomas - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php