AQDriverManager - Oracle 9i

The various implementations of the Java AQ API are managed via an AQDriverManager. Both OLite and Oracle8i will have an AQDriver which is registered with the AQDriver Manager. The driver manager is used to create an AQSession which can be used to perform messaging tasks.

When the AQDriverManager.createAQSession() method is invoked, it calls the appropriate AQDriver (amongst the registered drivers) depending on the parameter passed to the createAQSession() call.

The Oracle8i AQDriver expects a valid JDBC connection to be passed in as a parameter to create an AQSession. Users must have the execute privilege on the DBMS_AQIN package in order to use the AQ Java interfaces. Users can also acquire these rights through the AQ_USER_ROLE or the AQ_ADMINSTRATOR_ROLE. Users will also need the appropriate system and queue privileges for 8.1 style queue tables.

Methods

getDrivers

public static java.util.Vector getDrivers()

This method returns the list of drivers registered with the driver manager. It returns a Vector of strings containing the names of the registered drivers.

getAQSession

public static AQSession getAQSession (java.lang.Object conn)
throws AQException

This method creates an AQSession.

Parameter

conn

If the user is using the AQOracleDriver, then the object passed in must be a valid JDBC connection.

Multithreaded Program Support

Currently Java AQ objects are not thread safe. Therefore, methods on AQSession, AQQueueTable, AQQueue and other AQ objects should not be called concurrently from different threads. You can pass these objects between threads, but the program must ensure that the methods on these AQ objects are not invoked concurrently.

We recommend that multithreaded programs create a different AQSession in each thread (using the same or a different JDBC connection) and get new queue table and queue handles using the getQueueTable and getQueue methods in AQSession.

Loading the Java AQ Driver

To create an AQSession, you must first open a JDBC connection. Then you must load the AQDriver that you need to use in the application. With Oracle8i, the driver is loaded using the Class.forName("oracle.AQ.AQOracleDriver") command.

Note that the driver needs to be loaded only once (before the first createAQSession call). Loading the driver multiple times will have no effect.

Example

In general use only the interfaces and classes that are common to both implementations (as described in the first two tables). This will ensure that your applications are portable between Oracle8i and Olite AQ implementations.

oracle.AQ classes should not be used unless there is a method in these classes that is not available in the common interfaces. Note that since the AQQueue interface extends AQQueueAdmin, all queue administrative and operation functionality is available via AQQueue.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Oracle 9i Topics