MySql

Google

Blobs and MySQL

Submitted by Ravindra on Mon, 2008-10-27 01:46.

Since I came across this issue several times I thought of blogging about it to save my time and to help any one who might need this advice.

MySQL by default has a row size limit of 64K as at MySQL 5.0. Therefore if you save a file larger than that anything after the max size will not be saved. So do not be surprised if you find the data that is saved to be corrupted.

Obvious solution to this would be to increase the MySQL max_allowed_packet variable to a very high size.

But a more elegant solution would be to break up the large file in to separate rows.Another advantage of this approach is you can read one chunk at a time and stream vs reading the
entire file in to memory.

permalink

Spring with MySQL

Submitted by Ravindra on Sun, 2008-02-17 09:50.

First download the MySQL driver from
http://www.mysql.com/products/connector/j/

then edit the build.properties file as follows

db.url=jdbc:mysql://localhost/<db name>
db.driver=org.gjt.mm.mysql.Driver
db.username=<mysql  user name>
db.password=<mysql password>
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect

only value that might not change for your configuration is the db.driver.
as for hibernate.dialect value, open hibernate3.jar and browse to /org/hibernate/dialect/ to see the available dialects.

permalink

MySQL Reserved words

Submitted by Ravindra on Mon, 2008-02-11 07:14.

Recently i encountered an issue in executing the following statement.

insert into faq(mod,act,question,answer) values('home','default','test ques','test answer');

but the following SQL works after enclosing mod with in ``
insert into faq(`mod`,act,question,answer) values('home','default','test ques','test answer');

The reason is mod is a MySQL reserved word , thus the SQL should be enclosed with in ``.

permalink
Syndicate content