initSQL connection pooling
Today I learned how to execute sql statement when you application connect to oracle db using connection polling.
I need to set DATE format on db for connection session, so i found that statement:
And in db connection context parameter initSQL put this statement.
initSQL is new parameter in jdbc, so this doesn't work with ojdbc14.jar instead i recommend to use ojdbc6.jar. :]
you can see all examples on this page:
http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency
I need to set DATE format on db for connection session, so i found that statement:
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MM-YYYY HH24:MI:SS'
And in db connection context parameter initSQL put this statement.
<Resource name="jdbc/baza"meaning the ' is single quotation mark.
auth="Container"
scope="Shareable"
type="oracle.jdbc.pool.OracleDataSource"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:oradb"
initSQL="ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MM-YYYY HH24:MI:SS'"
user="user" password="user" / >
initSQL is new parameter in jdbc, so this doesn't work with ojdbc14.jar instead i recommend to use ojdbc6.jar. :]
you can see all examples on this page:
http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency
Hi,
ReplyDeleteI am facing same issue even using ODBC6 jar.
Ai am trying to execute the below query in initSQL "ALTER SESSION SET CURRENT_SCHEMA=". Can you please help me on this. Please note, this query is working fine in SQL editor.
Thanks
Hi,
ReplyDeleteI think you don't need to use quotes ( ')
for example
connect sys
ALTER SESSION SET CURRENT_SCHEMA=PLAYGROUND;
can you provide you stacktrace for more details...
Best Regards