Last night I tried to connected the MySQL server and the Sun Java Application Server 8.2. In my training place we are using the Oracle DB instead of MySQL. I learned how to connect the Oracle DB server and Sun Application server at there. This is the first time I tried to connect the MySQL and SJAPS. If u know how to connect any of the DB to the Sun App server, then it won't be a big issue for you to change it the to another. you need some extra jar files for that. For the Oracle all the jar files that need to connect the JDBC are available with the oracle installation package ( You can find that jar files inside the oracle_installation _dir\jdbc\lib ). But for the MySQL DB you need to download that jar files which name is Connector/J 5.1 ( http://dev.mysql.com/downloads/connector/j/5.1.html ). And here I put some important sstep to install the DataDirect MySQL Connect for JDBC drivers with the Sun Java System Application Server.
1. Copy the
Connector/J jar files ( You first downloaded connectorJ-verXXX-.jar then created a director with the name of
connectorj and past that jar file into that dir. Then you have to add the MySQL jdbc driver jar to the appserver classpath. And another the easiest way to do this is to place the jar file inside the
sun_app_ser_dir/domains/domain_dir/lib/ext and then reboot the Sun App server . Then its automatically add to the sun app classpath. You don't need to bother about that.
Note: sun_app_ser_dir is your Sun Java System Application Server installation directory, and
domain_dir is the name of the server domain being configured. For example, to install the JDBC drivers in the domain named domain1, copy the driver jar files to
SUNSERVER_home/domains/domain1/lib/ext
2. Make sure that the Sun Java System Application Server is running( YOU HAVE TO RESTART ) and open the Sun Java System Application Server Admin Console ( Referred to as "Admin Console" in later occurrences in this document ). If the Sun Java System Application Server is running on your local machine, you can open the Admin Console by navigating to http://localhost:4848/asadmin/index.html in a web browser.
3. If prompted, enter the administrator user ID and password.
4. In the left pane, expand the Resources item. Then, expand the
JDBC item under the
Resources item. Select the
Connection Pools item. The Connection Pool page appears in the right pane, displaying a list of available connection pools. On the Connection Pool page, click the
New button. The Create Connection Pool - General Settings page appears in the right pane allowing you to configure the general settings for the new connection pool.
a. Then type tne name for the new connection pool.
b. Select this resource types: Select javax.sql.DataSource ( for the use of local transactions only)
c. Select the mysql database.
d. Click
Next to continue. The Pool Settings, Connection Validation, Transaction Isolation, and Properties sections will displayed.
5. Then type the following in the 'Datasources Classname' text box
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
then its automatically display some Properties section below that 'Datasources Classname' text box .
Configure that. And save it. Restart the server. And Try the connection pool list is displayed in the right pane of the Admin Console > ResourcesJDBC > Connection Pools > JDBC item. The Connection Pool page appears in the right pane, displaying a list of available connection pools. And click the
Ping button to test the connection pool. If the driver and connection information have been specified correctly, a banner telling you the ping was successful, as shown in the following example, should be displayed at the top of the page.
This this a simplest way to create a JDBC pool in the Sun server with MySQL. Then you can easily create a
DBC Resources item under the JDBC item.
0 comments:
Post a Comment