This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes Post connection query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Post connection query" Watch "Post connection query" New topic
Author

Post connection query

Ash Jose
Greenhorn

Joined: Feb 14, 2009
Posts: 7
Hi,

I have defined a datasource to connect to Sybase DB. I need to run an authentication statement (SET TEMPORARY OPTION CONNECTION_AUTHENTICATION=....) after connection to keep the connection alive, else DB server will drop the connection after 10 seconds.

Is there a way to specify to run this in the connection parameters (DBCP params) so that all the connection in the pool have this authentication statement executed.

Thanks,
-ash
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

and you can't set this in the connection url?
Ash Jose
Greenhorn

Joined: Feb 14, 2009
Posts: 7
Wendy Gibbons wrote:and you can't set this in the connection url?


How do I set this in connection URL?
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

alongside the username and password and other settings like schema you just pop in CONNECTION_AUTHENTICATION=xxx
worth a try;
 
wood burning stoves
 
subject: Post connection query