jdbc driver specific properties

1,197 views
Skip to first unread message

SergPro

unread,
May 24, 2012, 7:32:46 PM5/24/12
to eb...@googlegroups.com
Hi,

I need to pass the following to Oracle JDBC driver, by default timeouts are very long and lock the application for too long oracle.net.CONNECT_TIMEOUT=3000;oracle.jdbc.ReadTimeout=10000.

EBean ORM documentation does not say anything about driver specific parameters.


In Tomcat, it would be like below (tested and working):

   <Resource 

      name="jdbc/name" 

      auth="Container"

      type="javax.sql.DataSource" 

      driverClassName="oracle.jdbc.OracleDriver"

      url="..."

      username="name" 

      password="password" 

      maxActive="50" 

      maxIdle="10"

      maxWait="5000"

      connectionProperties="oracle.net.CONNECT_TIMEOUT=3000;oracle.jdbc.ReadTimeout=10000"

   />

Josh Kamau

unread,
May 25, 2012, 12:42:23 AM5/25/12
to eb...@googlegroups.com

Rob Bygrave

unread,
May 25, 2012, 1:05:11 AM5/25/12
to eb...@googlegroups.com

I'm pretty sure he means ... how do I set custom/jdbc driver specific parameters when using Ebean's DataSource.

ie. can I specify something like ... ebean.ora.connectionProperties=oracle.net.CONNECT_TIMEOUT=3000;oracle.jdbc.ReadTimeout=10000 in the properties file or programmatically via ServerConfig.


Unfortunately the answer is that right now you can't.  If you look at DataSourceConfig it doesn't provide a place to put arbitrary connection properties. It is definitely something that you SHOULD be able to do though so I'll log it as an enhancement request and hopefully action it.

A workaround right now would be to use another external DataSource (but Ebean's own DataSource implementation is pretty darn good so we want to log this enhancement and sort it).


Cheers, Rob.

SergPro

unread,
May 26, 2012, 11:45:25 AM5/26/12
to eb...@googlegroups.com
Rob,

Would you post a ref to the enhancement so I know when it makes it's way to a release?

Thanks!

Rob Bygrave

unread,
May 27, 2012, 7:11:14 AM5/27/12
to eb...@googlegroups.com
FYI:

Logged as http://www.avaje.org/bugdetail-401.html

Fixed in HEAD.

DataSourceConfig now has a customProperties property which you can set if you are using programatic configuration.


If you are using ebean.properties you can set customProperties like:

datasource.ora.username=junk
...
datasource.ora.customProperties=oracle.net.CONNECT_TIMEOUT=3000;oracle.jdbc.ReadTimeout=10000


Cheers, Rob.

SergPro

unread,
May 27, 2012, 10:53:38 AM5/27/12
to eb...@googlegroups.com
Rob, Thanks a lot! 
I'll give it a try and report if any issues.
Serge
Reply all
Reply to author
Forward
0 new messages