Pepared Statements

Post here your suggestions for new possible features in SmartFoxServer.

Moderators: Lapo, Bax

Post Reply
Boing
Posts: 59
Joined: 11 Apr 2008, 14:57

Pepared Statements

Post by Boing »

I'm missing the possibility to use JDBC prepared statements. When the database gets under heavy load one day, it might be necessary to optimize everything that can be optimized.
I was surprised to not find a single thread regarding this topic.
Boing
Posts: 59
Joined: 11 Apr 2008, 14:57

Post by Boing »

Also I feel a little crippled by only being able to get Strings out of the DataRow. Am I getting something wrong or does this mean I have to parse every number and date I want to read from the database?
I would like to make use of the database features provided by SFS, for example the connection pool, but with such limitations I think I rather write my own db connector :(

Of course there is always a conflict between keeping the API simple and providing some flexibility. I would be happy to see SFS concentrate on the latter.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

You can actually access the connection object and use it as you prefer, working directly at the JDBC level.
Use the getConnection() method on any DbManager instance and also remember to close it when you want to return it back to the object pool.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Boing
Posts: 59
Joined: 11 Apr 2008, 14:57

Post by Boing »

Ah, I came from the tutorials and didn't check the API.
Thanks for the hint, that way you can indeed benefit from the SFS database connection pool.
May I ask which pool library you are using underneath (or is it self-written)? I once used the c3p0 pool and was quite content.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

We use Apache dbcp from their "Commons" library -> http://commons.apache.org/dbcp/
Lapo
--
gotoAndPlay()
...addicted to flash games
Boing
Posts: 59
Joined: 11 Apr 2008, 14:57

Post by Boing »

Okay, thanks for the information.
Post Reply