Day 7

Quiz

A1:

There are four JDBC driver types available: type 1, type 2, type 3, and type 4. These driver types should be used based on the application and environment requirements.

A2:

Since an applet runs in a restricted "sandbox" environment, it is recommended that the applet use a pure Java type 4 JDBC driver.

A3:

A type 3 driver is more suited for the setup described since a type 3 driver uses the existing vendor-specific JDBC driver for connecting to the database.

A4:

The simplest way to connect to the database in this scenario is to use the JDBC-ODBC bridge, the type 1 JDBC driver. A type 1 driver uses an existing ODBC configuration and does not require any additional vendor-specific drivers to be loaded.

A5:

The three ways to configure a database connection in WebLogic Server are with a connection pool, a MultiPool, or a DataSource.

A6:

A connection pool is a set of cached database connection objects, created and kept in a pool, which can be multiplexed to provide multiple clients access to a database resource.

A7:

A MultiPool is a pool of connection pools. This feature was introduced in WebLogic Server 6.0 and is best used in a replicated database server environment.

A8:

A DataSource is an intermediary between a JDBC application and the connection pool. A JDBC application requires a DataSource and JNDI to obtain a database connection. Each DataSource is linked to a distinct DataSource object.

Exercises

A1:

This JDBC-ODBC bridge setting is for the Microsoft 2000 O/S. It may vary slightly for other operating systems. Go to your computer's Control Panel > Administration > Data Sources (ODBC), and create a UserDSN for Microsoft Access DB (MDB). Select the Select option, and locate your previously created trialaccessdb.mdb file. Then click Advanced Options and specify the user name Admin and password password in this tab. Carry out the same procedure for the SystemDSN.

Now go to your BEA WebLogic Administration Console and click JDBC. Configure a new connection pool named AccessConnectionPool (you can use any name; just remember to define this connection pool name as the variable POOL_NAME in your JDBC application code). Set the properties as follows:

  1. URL: jdbc:odbc:trialaccessdb

  2. Driver Classname: sun.jdbc.odbc.JdbcOdbcDriver

  3. Properties: user=Admin

  4. Password: password

Click Create. Then click Targets and select the server either examplesServer or myServer and transfer the selection to the chosen selection box. Click Apply.

In your JDBC application code, use the following strings to open a database connection:

 private static final String DRIVER_NAME = "weblogic.jdbc.pool.Driver";  private static final String POOL_NAME = "AccessConnectionPool"; 

Now, to run this example, you need to restart your WebLogic Server so that WebLogic can initialize the connection pool on startup.

If you face any problems, check your JDBC-ODBC configuration and, most important, verify that you have configured the user name and password correctly in the user and System DSN settings. The System DSN is required since Windows 2000, based on Windows NT, requires that all users be able to access the database. The User DSN allows only the user configuring the database to access it.

Most important, check that the server on which you are running your exercises has been selected in the Target tab of the connection pool settings and has been transferred to the chosen section.

A2:

For detailed documentation, see

http://edocs.bea.com/wls/docs70/adminguide/utils.html#1143071

The command to execute this utility application is

 java -Dbea.home=license_location utils.dbping DBMS user password DB  

This is valid only for the following databases: ORACLE, ORACLE_THIN, MSSQLSERVER4, JCONNECT, JCONN2, INFORMIX4, and not for Microsoft Access or PointBase. Also, you need to specify the Dbea.home=license location parameter only if you are using the WebLogic-supplied drivers.

A3:

This file is located in the log directory of your server home. For example, if you are working on the examples server, then it will be located in the examples\log directory.

This file has a stack trace very similar to what you see on your console when an error occurs. This file can be opened while the server is running or shut down.



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net