How to set Oracle's fixedString property in Orion Application Server? - oracle

I want to set the fixedString=true connection property for the Oracle JDBC driver in the datasource definition in Orion Application Server 2.0.7 (latest stable release).
I've tried the following but didn't work:
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="datasource_name" location="jdbc/datasource_location"
connection-driver="oracle.jdbc.OracleDriver"
username="user" password="pass"
url="jdbc:oracle:thin:#//database_host:1521/XE" >
<property name="fixedString" value="true" />
</data-source>
Note: I've managed to set the property in Tomcat 6.0 this way (using the same Oracle JDBC driver, of course):
<Resource name="jdbc/datasource_name" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="user" password="pass" driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:#//database_host:1521/XE"
connectionProperties="fixedString=true;"
/>
But I need to set this in Orion. How can I do that?

It is a bug in the oracle application server you have to install OAS 10.1.2.3 has fix for that

Related

DB2 table not found when schema is mentioned in Jndi, but same works from normal db connection

When I am trying to connect to DB2 using schema definition in connection url it works fine
spring.datasource.url=jdbc:db2:/server:xxxx/ins:currentSchema=DEVSCHEMA;
but when the same is tried from tomcat jndi using
<Resource
auth="Container"
defaultAutoCommit="false"
driverClassName="com.ibm.db2.jcc.DB2Driver"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
initialSize="10"
maxActive="100"
maxIdle="80"
minEvictableIdleTimeMillis="55000"
minIdle="30"
name="jdbc/connDB"
password="xxxxxxx"
removeAbandoned="true"
removeAbandonedTimeout="55"
testOnBorrow="true"
timeBetweenEvictionRunsMillis="34000"
type="javax.sql.DataSource"
url="jdbc:db2:/server:xxxx/ins:currentSchema=DEVSCHEMA;"
username="xxxxx"
validationInterval="34000"
validationQuery="select 1 from sysibm.sysdummy1"/>
I get error
DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=DEVSCHEMA.tablename, DRIVER=4.31.10
The jar used in the classpath is jcc-11.5.7.0.jar, ojdbc6-11.2.0.4.jar, for both instances.
Using springboot version 2.7.4
Is there any configuration that needs to be added to fix the issue.

Application is not working in WebSphere

I deployed WAR file on Websphere console and mapped it to datasource. I am able to test the datasource which I configured with PostgreSQL server details. But my application is not connecting to the server. I am new to WebSphere and could anyone please help me to configure the datasource based on the below context.xml file. My application works well in tomcat but not in Websphere.
I think am doing something wrong in the datasource configuration.
<Resource
name="jdbc/domains/ABC" url="jdbc:postgresql://localhost:5432/postgres"
initConnectionSqls="SET search_path TO my_schme;"
username="abccc"
password="******"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
validationQuery="select 1"
initialSize="5"
maxActive="20"
maxIdle="10"
maxWait="-1"
/>
Here is an example based on the most common way to configure data sources in WebSphere Application Server Liberty -- in server.xml (it is also possible to define within the application via the standard #DataSourceDefinition annotation or deployment descriptor, which would be a separate example)
In server.xml,
<featureManager>
<feature>jdbc-4.2</feature>
<feature>jndi-1.0</feature>
... other features
</featureManager>
<dataSource id="ABC" jndiName="jdbc/domains/ABC" type="javax.sql.ConnectionPoolDataSource" validationTimeout="30s">
<jdbcDriver libraryRef="PostGreLib" javax.sql.ConnectionPoolDataSource="org.postgresql.ds.PGConnectionPoolDataSource"/>
<properties url="jdbc:postgresql://localhost:5432/postgres"/>
<containerAuthData user="abccc" password="******"/>
<connectionManager maxPoolSize="20" connectionTimeout="-1"/>
<!-- no equivalents for initialSize and maxIdle -->
<onConnect>SET search_path TO my_schme;</onConnect>
</dataSource>
<library id="PostGreLib">
<file name="C:/PostGreSQL/postgresql-42.1.4.jar"/>
</library>
Here are some helpful knowledge center articles on data source configuration in WebSphere Application Server Liberty,
https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/twlp_dep_configuring_ds.html
https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.liberty.autogen.base.doc/ae/rwlp_feature_jdbc-4.2.html

Tomcat Connection Pool's attribute setting

My web application connect DB by Tomcat jdbc pool.
this is my Tomcat context.xml
<Resource
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
name="jdbc/OracleDB"
auth="Container"
type="javax.sql.DataSource"
initialSize="70"
maxActive="100"
maxIdle="30"
minIdle="10"
maxWait="5000"
removeAbandoned="true"
removeAbandonedTimeout="60"
username="XXOO"
password="XXOO"
driverClassName="oracle.jdbc.driver.OracleDriver"
validationQuery="SELECT 'OK'"
testWhileIdle="true"
testOnBorrow="true"
numTestsPerEvictionRun="5"
timeBetweenEvictionRunsMillis="30000"
minEvictableIdleTimeMillis="60000"
url="jdbc:oracle:thin:#XXOO:testdb"/>
connection timeout will be happened 1min50sec
If I use JDBC to connect DB,it would not happen.
So what's setting do I lose or modify?

JNDI DataSource: migrating from Tomcat to jBoss/Wildfly

I have a web application that uses Tomcat 7, Spring MVC 4.0, and JPA (Hibernate implementation). I am migrating this application to jBoss/Wildfly application server.
Currently, the DataSource is injected in the application with JNDI in a Spring configuration file:
<jee:jndi-lookup id="dataSource" jndi-name="jdbc/MY_DB" expected-type="javax.sql.DataSource" />
The data source itself is defined in $CATALINA_HOME/conf/context.xml in the following way:
<Context>
<Resource name="jdbc/MY_DB"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/MY_DB?useUnicode=yes&characterEncoding=UTF-8"
username="user1"
password=""
validationQuery="select 1"
removeAbandoned="true"
removeAbandonedTimeout="120"
maxWait="60"
maxActive="20"
maxIdle="10" />
</Context>
How can I define this JNDI DataSource in JBoss/Wildfly?
First, you must make the JDBC driver available to the application server; then you can configure the data source itself.
See more details in Data Source Configuration in AS 7 and DataSource configuration

Data Source from Tomcat to JBoss 6.1

Below is the data source configuration in my Tomcat 7.
Need to convert this into JBoss 6.1, specifically the Eviction & removeAbandoned settings in the standalone.xml file.
Can anyone tell me where I can configure these settings in JBoss?
<Resource connectionCacheName="XXX"
connectionCachingEnabled="true" driverClassName="com.mysql.jdbc.Driver" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
initialSize="10" logAbandoned="true" maxActive="100" maxWait="10000" minEvictableIdleTimeMillis="60000"
minIdle="10" removeAbandoned="true" removeAbandonedTimeout="60" testOnBorrow="true"
testOnReturn="false" testWhileIdle="true" timeBetweenEvictionRunsMillis="30000"
type="javax.sql.DataSource" name="XXXX" url="jdbc:mysql://XXXX"
username="XX" password="XXXX" validationInterval="30000" validationQuery="SELECT
1"/>
According to this Tomcat to JBoss migration guide it should be:
4.x - 5.x - 6.x -> datasource-ds.xml file into JBOSS_HOME/server/[server-name]/deploy
7.x -> datasource-ds.xml file into JBOSS_HOME/standalone/deployments or as a module into JBOSS_HOME/modules

Resources