Enterprise Beans

Contact Us

Configure a Data Source with the J2EE Application Server


Data that is shared between web components and is persistent between invocations of a web application is usually maintained in a database. Web applications use the JDBC API to access relational databases.

 Configure a Data Source with the J2EE Application Server

  1. First check whether Microsoft SQL Server 2000 Driver for JDBC is installed in C:\Program Files\. If not installed then install it and then follow the steps
  2. Make the driver accessible to the common class loader. For s\this follow the steps
    1. Copy all the .jar (msbase.jar, mssqlserver.jar, msutil.jar) file from C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\ and paste it into E:\Sun\AppServer\domains\domain1\lib\ (or) copy its class files and paste into E:\Sun\AppServer\domains\domain1\lib\ext\
    2. Now restart the Application Server (Start->Program Files->Sun Microsystem-> Application Server PE->Stop Default Server)
  3. Make the driver accessible to the system class loader
    1. In the Admin Consoleís tree view, select Application Server from the left pane
    2. Select the JVM Settings tab in the right side
    3. On the JVM Settings page, click the Path Settings tab
    4. Now in the Classpath Suffix field, enter the fully-qualified path name for the driverís JAR file as follows
    5. Click the Save button
    6. Restart the Server
  4. Enter http://localhost:4848/asadmin in the address bar to open the Application Server Admin Console dialog box, and enter the User Name and Password
  5. Click the Log In button to open the Application Server Admin Console General Information dialog box
  6. Select the JDBC->Connection Pools option in the left pane to open the Application Server Admin Console Connection Pools dialog box
  7. Click the New button to open the Create JDBC Connection Pool: Enter connection pool name dialog box. Here, enter SQLServerPool in the Name text box and in the Datasource Classname text box

  8. Click the Next button, here in the Pool Settings session leave it as default values. In the Connection Validation session leave it as default. In the Transaction Isolation session select the read-uncommitted from the Transaction Isolation drop-down box. Also select the check box Guaranteed of the Isolation Level

  9. In the Property session add the following details (Here, delete the networkProtocol, roleName, datasourceName properties and add selectMethod property)
    databaseName: J2EE3_DEMO (database name where the BMP entity bean table are to be stored)
    serverName : BOURGIA-46B2604 (CLICK HERE for server-name)
    port : 1433
    user : sa
    password : ******** (CLICK HERE for password)
    selectMethod : cursor

  10. Click the Finish button and then select the SQLServerPool in the right pane and then click the Ping button in the right side
  11. Select the JDBC->JDBC Resources command in the left pane to open the Application Server Admin Console JDBC Resources dialog box
  12. Click the New button on the Create Resources pane. Here, enter the JNDI Name as jdbc/ejbUserAccount and Pool Name as SQLServerPool.
  13. Click the OK button
  14. Click the LOGOUT button at the top right side

 Click for Next Topic