Exforsys

WebSphere Tutorials

  1. WebSphere V5.0 : Building Expressions
  2. WebSphere V5.0 : Creating SQL statements
  3. WebSphere V5.0 : Applying DDL scripts to a remote database
  4. WebSphere V5.0 : Deploying to the database
  5. WebSphere V5.0 : Defining a table
  6. WebSphere V5.0 : Defining a database
  7. Working with Data in WebSphere
  8. WebSphere V5.0 : Debugging - JSP debugging
  9. WebSphere V5.0 : Debugging - Scrapbook Page
  10. WebSphere V5.0 : Debugging - View variables
  11. WebSphere V5.0 : Debugging - Step-through code
  12. WebSphere V5.0 : Debugging - Set breakpoints
  13. WebSphere V5.0 : Running Applications - Export J2EE applications
  14. WebSphere V5.0 : Running Applications - Run/operate server
  15. WebSphere V5.0 : Running Applications - Understand Session Manager
  16. WebSphere V5.0 : Running Applications - Configure data sources
  17. WebSphere V5.0 : Running Applications - Create server instance and server configuration
  18. WebSphere V5.0 : Web Development - Use Web Page Wizards
  19. WebSphere V5.0 : Web Development - Work with Web Application Deployment Descriptor
  20. WebSphere V5.0 : Web Development - Use content assist
  21. WebSphere V5.0 : Web Development - Use Page Designer to add and modify HTML and JSP content
  22. WebSphere V5.0 : Web Development - Understand classpath and module dependencies
  23. WebSphere V5.0 : Web Development - Create resources in appropriate J2EE locations
  24. WebSphere V5.0 : Web Development - Create a web project
  25. WebSphere V5.0 : Java Development - Use property dialogues
  26. WebSphere V5.0 : Java Development - Use hierarchy view
  27. WebSphere V5.0 : Java Development - Use task view
  28. WebSphere V5.0 : Java Development - Use search function
  29. WebSphere V5.0 : Java Development - Use content assist function and declarations
  30. WebSphere V5.0 : Java Development - Use refactoring features
  31. WebSphere V5.0 : Java Development - Use Outline View and Browsing View
  32. WebSphere V5.0 : Java Development - Create Java project, packages, classes, methods
  33. WebSphere V5.0 : Workbench Basics - Use the Help feature to aid in development activities
  34. WebSphere V5.0 : Workbench Basics - Import to and export from the workbench
  35. WebSphere V5.0 : Workbench Basics - Work with Perspectives
  36. WebSphere V5.0 : Workbench Basics - Set workbench preferences
  37. WebSphere V5.0 : Workbench Basics - Create J2EE projects

Ads


Home arrow Reviews arrow WebSphere Tutorials

WebSphere V5.0 : Running Applications - Configure data sources

Author : Exforsys Inc.     Published on: 19th May 2006    |   Last Updated on: 21st May 2006

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.

Ads

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

Ads

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.



 
This tutorial is part of a WebSphere Tutorials tutorial series. Read it from the beginning and learn yourself.

WebSphere Tutorials

  1. WebSphere V5.0 : Building Expressions
  2. WebSphere V5.0 : Creating SQL statements
  3. WebSphere V5.0 : Applying DDL scripts to a remote database
  4. WebSphere V5.0 : Deploying to the database
  5. WebSphere V5.0 : Defining a table
  6. WebSphere V5.0 : Defining a database
  7. Working with Data in WebSphere
  8. WebSphere V5.0 : Debugging - JSP debugging
  9. WebSphere V5.0 : Debugging - Scrapbook Page
  10. WebSphere V5.0 : Debugging - View variables
  11. WebSphere V5.0 : Debugging - Step-through code
  12. WebSphere V5.0 : Debugging - Set breakpoints
  13. WebSphere V5.0 : Running Applications - Export J2EE applications
  14. WebSphere V5.0 : Running Applications - Run/operate server
  15. WebSphere V5.0 : Running Applications - Understand Session Manager
  16. WebSphere V5.0 : Running Applications - Configure data sources
  17. WebSphere V5.0 : Running Applications - Create server instance and server configuration
  18. WebSphere V5.0 : Web Development - Use Web Page Wizards
  19. WebSphere V5.0 : Web Development - Work with Web Application Deployment Descriptor
  20. WebSphere V5.0 : Web Development - Use content assist
  21. WebSphere V5.0 : Web Development - Use Page Designer to add and modify HTML and JSP content
  22. WebSphere V5.0 : Web Development - Understand classpath and module dependencies
  23. WebSphere V5.0 : Web Development - Create resources in appropriate J2EE locations
  24. WebSphere V5.0 : Web Development - Create a web project
  25. WebSphere V5.0 : Java Development - Use property dialogues
  26. WebSphere V5.0 : Java Development - Use hierarchy view
  27. WebSphere V5.0 : Java Development - Use task view
  28. WebSphere V5.0 : Java Development - Use search function
  29. WebSphere V5.0 : Java Development - Use content assist function and declarations
  30. WebSphere V5.0 : Java Development - Use refactoring features
  31. WebSphere V5.0 : Java Development - Use Outline View and Browsing View
  32. WebSphere V5.0 : Java Development - Create Java project, packages, classes, methods
  33. WebSphere V5.0 : Workbench Basics - Use the Help feature to aid in development activities
  34. WebSphere V5.0 : Workbench Basics - Import to and export from the workbench
  35. WebSphere V5.0 : Workbench Basics - Work with Perspectives
  36. WebSphere V5.0 : Workbench Basics - Set workbench preferences
  37. WebSphere V5.0 : Workbench Basics - Create J2EE projects
 

Comments