Saturday, September 7, 2013

How to make MYSQL JDBC Connection in Websphere Server

we need to do three task to achieve this:-
  • Create j2c authentication
  • Create jdbc provider 
  • And in the end create data source.  

1.  Log in to websphere server console.

2. Navigate to security then global security and in the end to J2C authentication data as shown in below figure.


3. Click on new and create j2c authentication data to connect with mysql server.
     We need to provide user id and password on mysql server here..
4.  Click on apply and save this new setting in server configuration file.

5. Now lets create JDBC provider for our mysql server.
      Navigate to JDBC provider under resources as shown in figure. and click on new to create new jdbc       provider.

select database type as user define and give "com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource" under implementation class name, then click on next 

6. In  step provide MYSQL jdbc jar location .
7. Click on next and then finish. server console will ask to save configuration in master file select save and by this we have completed our 2 Task.

8. Now go to Data Sources and click new to create data source 
9. now select JDBC provider name which we created above.
10.   In the next step give the following class name for datastore helper class.
"com.ibm.websphere.rsadapter.ConnectJDBCDataStoreHelper"  as shown in figure 
11.  Next provide j2c authentication information which we created in previous step.

12.  Click on finish and save it.

13. Now go to custom properties on connection and check for the following parameters.
  •            port
  •           serverName
  •           databaseName (if required )
  •            user
  •          password
sometimes connection doesn't create these parameters automatically, which are required to set up connection.
If these parameters are not available under custom properties create new one and provide yours mysql specific values. 

14 click on finish and  we are done with our MYSQL  jdbc connection ...

Note: mysql version should match with its corresponding jar version....



No comments: