Upload
vishnubovilla
View
25
Download
0
Embed Size (px)
DESCRIPTION
ATG - Data Source
Citation preview
. The data source is based on /atg/dynamo/service/jdbc/
JTDataSource, a Nucleus service that creates new connections to a particular database
The default DataSource connection pool, JTDataSource, uses the FakeXADataSource component. Configure
the desired connection pool properties, but note that this datasource should be used only to run Oracle ATG
Web Commerce data import scripts.
You can set up and configure a connection pool manually by creating two files in your localconfig/atg/
dynamo/service/jdbc/ directory:
• connectionPoolName.properties
• connectionPoolNameFakeXA.properties
where connectionPoolName is the name of the connection pool you want to create.
The connectionPoolName.properties file contains properties and values similar to the following:
$class=atg.service.jdbc.MonitoredDataSource
min=10
max=10
blocking=true
maxFree=-1
loggingSQLWarning=false
loggingSQLDebug=false
loggingSQLInfo=false
dataSource=/atg/dynamo/service/jdbc/<connectionPoolName>FakeXA
loggingSQLError=false
The min property determines the number of connections that the pool starts out with. The max property
determines how many connections are to be kept around in the pool. When the pool starts, it immediately
creates the minimum number of connections. Whenever a service requires a connection, it takes one from the
pool. If there are no connections free, then the connection pool creates a new connection, until the maximum is
reached. Due to various initialization calls, Oracle ATG Web Commerce requires at least three JDBC connections
on install or when started with a new database. Setting the JDBC connection pool’s max property to anything
less causes Oracle ATG Web Commerce to hang when starting up.
If the maximum has been reached and a service requires another connection, then the service blocks until some
other service frees up a connection. If the blocking property is set to false, then instead of blocking, the
connection pool fails and results in a SQL exception.
The connectionPoolNameFakeXA.properties file contains properties and values similar to the following:
$class=atg.service.jdbc.FakeXADataSource
server=localhost:1313
user=admin
needsSeparateUserInfo=false
URL=jdbc:mysql://localhost:3306
readOnly=false
password=admin
database=
driver=com.mysql.jdbc.Driver
Note: Entering passwords in clear text files entails some security risks. Take steps to secure files that contain clear
text passwords.
These properties tell the connection pool how to make a connection. The driver parameter specifies the name
of the driver that should be used. The URL property specifies the name of the database server machine, the port
of the database server (optional), and the name of the database on the server (optional). The format of the URL
looks like this:
jdbc:driver name[:additional server information]
By default, the connection pool’s driver and URL are configured for the MySQL database, as follows:
driver=com.mysql.jdbc.Driver
URL=jdbc:mysql://localhost:3306/<db-name>
Configuring Data Sources for JBoss
Oracle ATG Web Commerce applications running on JBoss use a JTDataSource component, which should be
configured to point to a JNDI reference to a DataSource component running in JBoss.
Where to Configure JBoss Data Sources
You should configure your data source in the localconfig, jbossconfig, or equivalent named configuration
layer. See “Managing Properties Files” in the ATG Platform Programming Guide for information on applicationserver-specific and named configuration layers.
In order to use the jbossconfig directory:
• Modify the MANIFEST.MF file for the given Oracle ATG Web Commerce module to include the following
property:
ATG-JbossConfig-Path: jbossconfig
• Create a jbossconfig directory and put the properties files there.
Note: If JBoss configuration files are stored in the ATG-3rdPartyConfig-Path layer, you might see errors if
you start up applications on other application servers, because the datasources are configured to point to JNDI
names that are not set up on that application server. Datasource configuration files that are specific to JBoss
should be in the ATG-JBossConfig-Path rather than the ATG-3rdPartyConfig-Path of those data source
configurations.
Configuring New JBoss Datasources
To configure a new data source, go to the <JBdir>\server\server_name\deploy\atg-ds.xml file. Edit the
following configuration settings:
JNDI name
URL
driver class
username
password
transaction isolation level
connection pool numbers
See your application server documentation for information on the available parameters. For example:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<xa-datasource>
<jndi-name>atgcore_ds</jndi-name>
<track-connection-by-tx>false</track-connection-by-tx>
<isSameRM-override-value>false</isSameRM-override-value>
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeo
<idle-timeout-minutes>15</idle-timeout-minutes>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transactionisolation>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xadatasource-class>
<xa-datasource-property
name="URL">jdbc:oracle:thin:@myserver:1521:ora10r2</xa-datasource
property>
<xa-datasource-property name="User">username</xa-datasource-property>
<xa-datasource-property name="Password">password</xa-datasource-property>
<!-- Uncomment the following if you are using Oracle 9i
<xa-datasource-property name="oracle.jdbc.V8Compatible">true</xadatasource-property>
-->
<exception-sorter-class-name>
org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
</exception-sorter-class-name>
</xa-datasource>
</datasources>
Note: Entering passwords in clear text files entails some security risks. Take steps to secure files that contain clear
text passwords.
If you have changed the JNDI name, you must also change the name configured in the <ATG10dir>/home/
localconfig/atg/dynamo/service/jdbc/JTDataSource.properties file:
$class=atg.nucleus.JNDIReference
JNDIName=JNDIDataSourceName
For example, java:/ATGOracleDS.
Note that if you are using a WatcherDataSource, this would be configured instead in a
DirectJTDataSource.properties file.