In my previous post
about "Data sources and Advantages" I have explained about Datasources and It's advantages
over Driver manger in JAVA/J2EE based applications. In this post I will show
how to setup DataSources on Websphere application server, which can be used in
applications using JNDI name.
Following are the
steps to create Datasources on Websphere :
1.Start the
WebSphere Application Server and login to administrative console.
2. Click Security -> Global security. Under Authentication, expand Java Authentication
and Authorization Service and click J2C authentication data.
3. Click New and enter the Alias, User ID and Password,click Ok.(This will be the user name and password of DB).
4. On the administrative console, expand Resources. Expand JDBC then click JDBC Providers.In the Scope section, choose the appropriate scope depending on the usability of Datasource.
5.Click New to create a new JDBC driver. Select, the Database type, Provider type, Implementation type and Name. The Name automatically fills based on the implementation type chosen.
6.Click Next and configure the database class path. Click Next.
7.On the Summary page, click Finish.Click Save to save your selections to Master configurations. The JDBC providers page then appears.
8.On the administrative console, click Data sources. Click New to create a new data source. Enter the Data source name and the JNDI name, and choose the authentication alias from the drop-down list in Component-managed authentication alias. This JNDI name will be used in the applications.
9. Click Next and select the JDBC provider which was created earlier and click Next.
10. Enter the Database name and and server name where DB is located.Deselect the checkbox, Use this data source in container managed persistence (CMP). Click Next.
11. Select Component-managed authentication alias and Container-managed authentication alias.
12.On the Summary page, click Finish.
13.The Data sources page displays, Click Save. Click Test Connection. The message should indicate that the connection is successful. Ignore any warnings.
No comments:
Post a Comment