Exforsys.com
 
Home Tutorials WebSphere
 

WebSphere V5.0 : Running Applications - Configure data sources

 

WebSphere V5.0 : Running Applications - Configure data sources

In this tutorial you will learn about WebSphere V5.0 : Running Applications - Configure data sources, Data sources, Data sources work, Setting up a server to test data sources.



Data sources

As defined in the Sun JDBC 2.0 Standard Extension specification, data sources allow you to manage a pool of connections to a database. Using connection pools provides you with the following advantages:


  • It improves performance. Creating connections is expensive; a data source creates a connection as soon as it is instantiated.
  • It simplifies resource allocation. Resources are only allocated from the data sources, and not at arbitrary places in the code.
  • It simplifies connection calls. To get a connection in JDBC 1.0, you would need to call Class.forName() on the class name of the database driver, before making DriverManager calls.

Data sources work as follows:

  1. When a servlet, or other client, wants to use a connection, it looks up a data source by name from a JNDI server.
  2. The data source then returns a connection to the client.
  3. If the data source has no more connections, it may ask the database manager for more connections (as long as it has not exceeded the maximum number of connections).
  4. When the client has finished with the connection, it closes the connection.
  5. The data source then returns the connection to the available pool.

You can configure data sources for WebSphere Application Server V4 and V5 by using the data source page in the server editor.


Setting up a server to test data sources

If you want to test data sources on Websphere Application Server, you may need to do one of the following steps:


  1. Create a WebSphere Server.
  2. In the Server Configuration view, double-click the server. The server editor opens.
  3. Select the Data source tab at the bottom of the editor.

Data source tab


4. For V5 only: To test data sources at the node level, expand Node Settings. To test data sources at the server level, expand Server Settings.

5. A JDBC provider for DB2 and for Cloudscape will already be created for you (in the Server Settings section only). In that case, you may skip next step if the predefined JDBC provider satisfies your requirements. Before using the predefined JDBC provider, verify that the Class path field specified in the JDBC provider is the correct class path that contains the database driver. Select the JDBC provider from the JDBC provider list and click Edit to edit the JDBC class path.

Edit JDBC provider


6. Create a JDBC provider. A JDBC provider contains configuration for software that enables Java applications to connect to JDBC-compliant databases.

a. Beside the JDBC provider list table, click Add. The Create a JDBC Provider wizard opens.

b. In the Database type list box, select a database type.

Database type


c. In the JDBC provider type list box, select a JDBC provider and click Next.

d. In the Name field, type the name of the resource provider.

e. In the Implementation class name field, select or type the Java class name of the JDBC provider implementation.

f. In the Class path list box, if a driver path does not appear, click the Add Path... or the Add External JARs... button (you do not need to specify a class path if you are using Cloudscape). Type or browse to the path where JAR files containing driver classes are located. Ensure that the class path for the JDBC driver is specified correctly for the installation of DB2 on the machine where you are running WebSphere Application Server.

g. In the Native path list box, specify a list of paths that forms the location for the resource provider native libraries. Native path entries are separated by using the ENTER key and must not contain path separator characters (such as ';' or ':'). Native paths can contain variable (symbolic) names which you can substitute using a variable map.


Database Name


h. Click Finish.

7. Define a data source.

a. Beside Data sources defined in the JDBC provider selected above list, click Add. The Create a Data Source wizard opens:

Data Source Dialog


b. Select the type of JDBC provider, for example Cloudscape JDBC Provider 5.0.

c. Select Version 5.0 data source and click Next.

d. On the Modify Data Source page, specify the details of the data source that you want to create. For more information about any of the fields on this wizard, select the field and then press F1. Click Next.

Modify Data Source


e. On the Modify Resource Properties page, select the resource property you want to modify, for example databaseName.

f. In the Value field, type the value for this property.


Modify Resource Properties


Click Finish.

8. Define resource properties for the data source. If you are setting up a data source for a remote database, specify the database-specific information, such as PortNumber and URL, by adding a resource property.

a. Beside Resource properties defined in the data source selected above list, click Add. The Add a resource property dialog box opens:


Add a resource property



b. In the Name field, type the name associated with this property, such as PortNumber or ConnectionURL.

c. In the Type field, type the fully qualified Java type of this property, such as java.lang.Integer or java.lang.Byte.

d. In the Value field, type the value associated with this property in this property set.

e. In the Description field, type the text to describe any bounds or well-defined values for this property.


f. Click OK.

Data Source


9. Save and close the server editor.


_________________


Author: Mikalai Zaikin. Please Click Here to visit Authors site for any updates and changes to the study notes.



Read Next: WebSphere V5.0 : Running Applications - Understand Session Manager



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2010 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape