Sun Application Server
Table of ContentsIntegrate Sun Application Server With MySQL
- Install MySQL
- Install SUNWappserver
- Create a MySQL database for SUNWappserver use. Remember username and password as you will need this information for configuring the SUNWappserver Connection Pool.
- Get mysql-connector-java-3.1.11-bin.jar from http://www.mysql.com/products/connector/j/
- Assuming you installed SUNWappserver in /opt/ on Linux, install mysql-connector-java-3.1.11-bin.jar into /opt/SUNWappserver/mysql/lib/, otherwise find an appropriate place.
- Run your Admin Console
- Supply user and password to login
- In the Application Server -> JVM Settings -> Path Settings -> Classpath Suffix:, add fully qualified path to mysql-connector-java-3.1.11-bin.jar in the Classpath Suffix section.
- You will need to restart application server - do so now.
- log back in
- In the admin Console, find the JDBC expandable link at the left. In fact it is the second link at the navigational panel on your left explorer. Click on it
- It will open a new view on the right hand side namely JDBC Resource and Connection Pools
- Click on connection pool.
- Select "New" under Current Pool
- Name enter any name to identify this connection pool.
- Select Resource Type. I normally use javax.sql.DataSource.
- Database Vendor find mysql and select it or select your vendor or leave blank if your vendor does not appear.
- Click next
- Data Source Class Name: enter your class name. For MS access enter sun.jdbc.odbc.JdbcOdbcDriver. For MySQL do not enter com.mysql.jdbc.Driver as it is not an implementation of javax.sql.DataSource. You want to use com.mysql.jdbc.jdbc2.optional.MysqlDataSource which implements javax.sql.DataSource, or com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource which implements javax.sql.ConnectionPoolDataSource. Change your "Resource type" accordingly.
- Click next
- Scroll down to Additional Properties.
- Populate host name, user, pasword, database name, port 3306 (default)
- Click on Save
- Click on Ping to test
- Go to JDBC Resource at the top of left navigational explorer and click JDBC Resources.
- Click new.
- Enter the JNDI Name you will use to identify the connection pool in your application i.e ejb/customer or anything you want. Select the Pool Name you just configured from the list
- Click save.
- Go back to Connection Pools navaigational link and select your database you configured.
- Click ping. If you get errors that means it is not yet working.
References
on 2009/02/24 16:53