Page 1 of 1

Pepared Statements

Posted: 06 Oct 2008, 12:19
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.

Posted: 06 Oct 2008, 13:53
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.

Posted: 20 Oct 2008, 04:35
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

Posted: 21 Oct 2008, 06:58
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.

Posted: 21 Oct 2008, 07:09
by Lapo
We use Apache dbcp from their "Commons" library -> http://commons.apache.org/dbcp/

Posted: 22 Oct 2008, 14:35
by Boing
Okay, thanks for the information.