Re: WebObjects and MySQL
Re: WebObjects and MySQL
- Subject: Re: WebObjects and MySQL
- From: Lon Baker <email@hidden>
- Date: Fri, 30 Jan 2004 04:37:23 -0500
Hello,
> In the EO JDBC connection dialog set a user name and password that you
> previously right to MySQL
>
> For URL enter: (where MyDBname is the database you set up)
> jdbc:mysql://localhost/MyDBname?capitalizeTypeNames=true
I use this URL:
jdbc:mysql://localhost/MyDBname?
capitalizeTypeNames=true&autoReconnect=true&maxReconnects=3
For quick review of the actual sql mysql is processing you can add
"&profileSql=true" to the URL. Which I find more helpful sometimes when
I am sure I need to look just the SQL versus what EOF is doing.
>
> For Driver enter:
> org.gjt.mm.mysql.Driver
When they officially moved the driver into the MySQL organization they
made that name change.
This is the new Driver entry: com.mysql.jdbc.Driver
I also recommend reviewing the my.cnf files and placing the appropriate
one with modifications in the data directory. If you handle any file
uploads or insertion of large objects you will want to adjust the
"max_allowed_packet" variable. I believe it is set to 2 MB by default
and I bump that up to 8 MB to handle file uploads. My experience is
that you want to set it slightly larger then maximum size you expect to
handle. In my case 5 MB is my max I allow in the application.
A couple of other notes purely from experience so your mileage my vary.
Do not use DISTINCT in your fetch specifications unless you truly need
it. MySQL takes a pretty big performance hit when using DISTINCT in
queries.
On top of the usual EOF optimizations, spend time analyzing the sql for
SELECT statements using the EXPLAIN query to insure you are using the
most efficient tables and indexes. An better overview of this can be
found here http://www.kuro5hin.org/story/2004/1/18/33246/0547
Beware of raw rows or frequently refetched objects when using the
array.@count functionality on WOConditionals as it can chew up your
performance faster than you realize. This is something you will see
when you start viewing what mysql is actually querying and how many
times it is performing the queries. This is not an issue for EOF cached
objects obviously.
Anyway just a couple of tips from my experience. I am sure more
experienced developers can correct anything I misstated.
Lon Baker
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.