You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Peter Tom <pe...@gmail.com> on 2019/04/12 08:52:57 UTC

connectionInitSqls

Hi all,

I have third party application installed on Tomcat 8.5.

The application uses DB Oracle connection (ojdbc7) and everything working
fine.

I would like to set session parameter on first db connect (alter session
set NLS_NUMERIC_CHARACTERS = '.,')

I added this (connectionInitSqls ="alter session set NLS_NUMERIC_CHARACTERS
= '.,'") into the context.xml file in the app. META-INF directory:


 <Resource auth="Container" driver="oracle.jdbc.OracleDriver"
factory="org.apache.tomcat.dbcp.dbcp2.cpdsadapter.DriverAdapterCPDS"
name="jdbc/ZDB_TESTCPDS"
type="org.apache.tomcat.dbcp.dbcp2.cpdsadapter.DriverAdapterCPDS"
url="jdbc:oracle:thin:@10.16.43.3:1521:ZDB001"/>
 <Resource auth="Container"
dataSourceName="java:/comp/env/jdbc/ZDB_TESTCPDS" defaultMaxActive="10"
defaultMaxIdle="5" defaultMaxWait="10000"
factory="org.apache.tomcat.dbcp.dbcp2.datasources.PerUserPoolDataSourceFactory"
logAbandoned="true" name="jdbc/ZDB_TEST" removeAbandoned="true"
removeAbandonedTimeout="300" testOnBorrow="false"
type="org.apache.tomcat.dbcp.dbcp2.datasources.PerUserPoolDataSource"
validationQuery="select 1 from AnyTable" *connectionInitSqls ="alter
session set NLS_NUMERIC_CHARACTERS = '.,'"*/>
 </Context>


But still not working.

Has somebody idea how to solve it?


thank you
Peter

Re: connectionInitSqls

Posted by John Dale <jc...@gmail.com>.
Are you using the "*" (splat/star/asterisk) characters below to
highlight the configuration entry for our benefit?

Are you sure you're putting the connectionInitSqls on the correct
Resource element below (noticed you had two)?  Try verifying the JNDI
lookup in your code with the configuration below just to make sure.

Also, logs?

On 4/12/19, Peter Tom <pe...@gmail.com> wrote:
> Hi all,
>
> I have third party application installed on Tomcat 8.5.
>
> The application uses DB Oracle connection (ojdbc7) and everything working
> fine.
>
> I would like to set session parameter on first db connect (alter session
> set NLS_NUMERIC_CHARACTERS = '.,')
>
> I added this (connectionInitSqls ="alter session set NLS_NUMERIC_CHARACTERS
> = '.,'") into the context.xml file in the app. META-INF directory:
>
>
>  <Resource auth="Container" driver="oracle.jdbc.OracleDriver"
> factory="org.apache.tomcat.dbcp.dbcp2.cpdsadapter.DriverAdapterCPDS"
> name="jdbc/ZDB_TESTCPDS"
> type="org.apache.tomcat.dbcp.dbcp2.cpdsadapter.DriverAdapterCPDS"
> url="jdbc:oracle:thin:@10.16.43.3:1521:ZDB001"/>
>  <Resource auth="Container"
> dataSourceName="java:/comp/env/jdbc/ZDB_TESTCPDS" defaultMaxActive="10"
> defaultMaxIdle="5" defaultMaxWait="10000"
> factory="org.apache.tomcat.dbcp.dbcp2.datasources.PerUserPoolDataSourceFactory"
> logAbandoned="true" name="jdbc/ZDB_TEST" removeAbandoned="true"
> removeAbandonedTimeout="300" testOnBorrow="false"
> type="org.apache.tomcat.dbcp.dbcp2.datasources.PerUserPoolDataSource"
> validationQuery="select 1 from AnyTable" *connectionInitSqls ="alter
> session set NLS_NUMERIC_CHARACTERS = '.,'"*/>
>  </Context>
>
>
> But still not working.
>
> Has somebody idea how to solve it?
>
>
> thank you
> Peter
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org