Sun ONE APPSERVER 7 Connection Method and Call for Pool and Data Sources
Configure the connection pool and data source:
1. Start AppServer
2. Open the browser:
Http: // localhost: 4848 /; The port number of the console is adjusted according to its own installation.
3. After logging in, select:
l app server instancesàserver1àjdbcàconnection pools
l Click the New ... button
At http: // localhost: 4848 /; the port number of the console is adjusted according to its own installation.
L Step 1: In the general page, enter the name of the connection pool in the Name column, such as Oracle_pool; in the Database Vendor Bar, select Oracle 9.x; then click the next "button
l Then in the STEP 2: General page, enter: Oracle.jdbc.pool.racleDataSource; then add various properties of the connection pool, the default properties include:
Servernameà192.9.150.11
Portnumberà1521
Useràoracle
Passwordàoracle
DatabaseNameàdb
Then click on the Add button under Properties, then a new property input box appears in the bottom of the default properties bar, then build URL properties here.
Urlà oracle.jdbc.pool.racledataSource
l Other properties are default, then click the Finish button to complete the registration of the connection pool.
4. Create a data source: Select App Server InstancesàServer1àjdbcàJDBC Resources
Click New ... button à Enter the properties of the data source:
JNDI Nameà, such as: ORACLEDS
Pool Nameà Select the connected pool in front: Oracle_pool
Click the OK button to complete the registration of the data source.
Call data source:
Add the following code in the test class:
Context ctx = new initialContext ();
DataSource DS = (Datasource) CTX.lookup ("ORACLEDS");
System.out.println ("Datasource IS: DS);
CONNECTION TESTCONN = DS.GetConnection ();
System.out.println ("Connection from DataSource IS:" TestConn);