This method registers a QueueConnectionFactory or TopicConnectionFactory through the database to a Lightweight Directory Access Protocol (LDAP) server with JDBC connection parameters. This method is static and has the following parameters:

Parameter

Description

connection

JDBC connection used in registration

conn_name

Name of the connection to be registered

hostname

Name of the host running Oracle Streams AQ

oracle_sid

Oracle system identifier

portno

Port number

driver

JDBC driver type

type

Connection factory type (QUEUE or TOPIC)

The database connection passed to registerConnectionFactory must be granted AQ_ADMINISTRATOR_ROLE. After registration, you can look up the connection factory using Java Naming and Directory Interface (JNDI).

Example 12-1 Registering Through the Database Using JDBC Connection Parameters

This method registers a QueueConnectionFactory or TopicConnectionFactory through LDAP with JDBC connection parameters to LDAP. It is static and has the following parameters:

Parameter

Description

env

Environment of LDAP connection

conn_name

Name of the connection to be registered

hostname

Name of the host running Oracle Streams AQ

oracle_sid

Oracle system identifier

portno

Port number

driver

JDBC driver type

type

Connection factory type (QUEUE or TOPIC)

The hash table passed to registerConnectionFactory() must contain all the information to establish a valid connection to the LDAP server. Furthermore, the connection must have write access to the connection factory entries in the LDAP server (which requires the LDAP user to be either the database itself or be granted GLOBAL_AQ_USER_ROLE). After registration, look up the connection factory using JNDI.

12.2.4Registering Through LDAP Using a JDBC URL

This method registers a QueueConnectionFactory or TopicConnectionFactory through LDAP with JDBC connection parameters to LDAP. It is static and has the following parameters:

Parameter

Description

env

Environment of LDAP connection

conn_name

Name of the connection to be registered

jdbc_url

URL to connect to

info

Properties information

type

Connection factory type (QUEUE or TOPIC)

The hash table passed to registerConnectionFactory() must contain all the information to establish a valid connection to the LDAP server. Furthermore, the connection must have write access to the connection factory entries in the LDAP server (which requires the LDAP user to be either the database itself or be granted GLOBAL_AQ_USER_ROLE). After registration, look up the connection factory using JNDI.

12.3.2Unregistering Through LDAP

This method unregisters a QueueConnectionFactory or TopicConnectionFactory in LDAP. It is static and has the following parameters:

Parameter

Description

env

Environment of LDAP connection

conn_name

Name of the connection to be registered

The hash table passed to unregisterConnectionFactory() must contain all the information to establish a valid connection to the LDAP server. Furthermore, the connection must have write access to the connection factory entries in the LDAP server (which requires the LDAP user to be either the database itself or be granted GLOBAL_AQ_USER_ROLE).

If the queue table is used to hold queues, then the queue table must not be multiconsumer enabled (default). If the queue table is used to hold topics, then the queue table must be multiconsumer enabled.

CLOB, BLOB, and BFILE objects are valid attributes for an Oracle Streams AQ object type load. However, only CLOB and BLOB can be propagated using Oracle Streams AQ propagation in Oracle8i and after.

If the caller that opened the connection is not the owner of the queue table, then the caller must have Oracle Streams AQ enqueue/dequeue privileges on queues/topics in the queue table. Otherwise the queue table is not returned.

In Example 12-17, if an order cannot be filled because of insufficient inventory, then the transaction processing the order is terminated. The bookedorders topic is set up with max_retries = 4 and retry_delay = 12 hours.Thus, if an order is not filled up in two days, then it is moved to an exception queue.

12.9.1Granting Oracle Streams AQ System Privileges

This method grants Oracle Streams AQ system privileges to a user or role.

Parameter

Description

privilege

ENQUEUE_ANY, DEQUEUE_ANY or MANAGE_ANY

grantee

Grantee (user, role, or PUBLIC)

admin_option

If this is set to true, then the grantee is allowed to use this procedure to grant the system privilege to other users or roles

Initially only SYS and SYSTEM can use this procedure successfully. Users granted the ENQUEUE_ANY privilege are allowed to enqueue messages to any queues in the database. Users granted the DEQUEUE_ANY privilege are allowed to dequeue messages from any queues in the database. Users granted the MANAGE_ANY privilege are allowed to run DBMS_AQADM calls on any schemas in the database.

12.9.2Revoking Oracle Streams AQ System Privileges

This method revokes Oracle Streams AQ system privileges from a user or role. It has the following parameters:

Parameter

Description

privilege

ENQUEUE_ANY, DEQUEUE_ANY or MANAGE_ANY

grantee

Grantee (user, role, or PUBLIC)

Users granted the ENQUEUE_ANY privilege are allowed to enqueue messages to any queues in the database. Users granted the DEQUEUE_ANY privilege are allowed to dequeue messages from any queues in the database. Users granted the MANAGE_ANY privilege are allowed to run DBMS_AQADM calls on any schemas in the database.