Websphere and MySQL datasource

This is about how to create a MySQL datasource in Websphere Test Environment via WSAD (Websphere Studio Application Developer).

Open the server configuration and select the data source tab. Select then the following parameters

  • jdbc typeDatabase type: User-defined
  • JDBC provider type: User-defined JDBC Provider

Then hit next and in the next screen input the following parameters

jdbc settings

  • Name: MySQL
  • Description: blablabla
  • Implementation class name: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
  • class path: remove the existing one and use add external jar pointing to the right MySQL jdbc jar file (mysql-connector-java-5.0.5-bin.jar in my case).

After confirming the JDBC provider, select it from the list and select add next the data source box (just below). Use the Version 5.0 data source, and use next to proceed. Input the following data

Data source settings

  • Name: <name of the jdbc>
  • JNDI Name: jdbc/<name of the jdbc>
  • Data source helper class name: com.ibm.websphere.rsadapter.ConnectJDBCDataStoreHelper

Notice that the helper class is very important. Ensure to use the one specified or things wont works fine.

Now It’s time to input the connection parameters. In the next box (resource properties), after selecting the just created data source, click add until input all those properties:

sample property

  • databaseName: <yourdatabase>?autoReconnect=true (java.lang.String)
  • factory: com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory
  • password: <the password>
  • port: 3306 (or your port if installation is customized)
  • serverName: <your server name>
  • user: <the user for connection>

After this, remember to refer to the data source in web.xml and restart the server.

5 comments so far

  1. sanka dilmadu on

    actually its better.there are limited resources for websphere and mysql with graphics.thank u.for help.

  2. sanka dilmadu on

    And there must be some addtional things shloud be add to this site.Database name port servername how can I give those things for connection?

  3. edivad on

    @sanka, every information you need is in the article. See la lasts paragraphs.

  4. sanka on

    yep following thing must add manually no?
    user:root
    password:sanka
    * databaseName: ?autoReconnect=true (java.lang.String)
    * factory: com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory
    * password:
    * port: 3306 (or your port if installation is customized)
    * serverName:
    * user:
    anyway thanx machan..

  5. coder on

    this is better to more strtuts and ASP and AJAX example view
    http://www.codexamples.blogspot.com/ you can get more idea about this


Leave a reply