09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Registering a Queue/Topic Connection Factory Through LDAP—with a JDBC URL<br />

Purpose<br />

Register a queue/topic connection factory through LDAP with JDBC connection<br />

parameters to LDAP.<br />

Usage Notes<br />

registerConnectionFactory is a static method. To successfully register the<br />

connection factory, the hashtable passed to registerConnectionFactory must<br />

contain all the information to establish a valid connection to the LDAP server.<br />

Furthermore, the connection must have write access to the connection factory<br />

entries in the LDAP server (which requires the LDAP user to be either the database<br />

itself or be granted global_aq_user_role). After registration, look up the<br />

connection factory using JNDI.<br />

Syntax<br />

See Java (JDBC): <strong>Oracle</strong>9i Supplied Java Packages Reference oracle.jms,<br />

AQjmsFactory.registerConnectionFactory.<br />

Example<br />

String url;<br />

Hashtable env = new Hashtable(5, 0.75f);<br />

/* the following statements set in hashtable env:<br />

* service provider package<br />

* the URL of the ldap server<br />

* the distinguished name of the database server<br />

* the authentication method (simple)<br />

* the LDAP user name<br />

* the LDAP user password<br />

*/<br />

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");<br />

env.put(Context.PROVIDER_URL, "ldap://sun-456:389");<br />

env.put("searchbase", "cn=db1,cn=<strong>Oracle</strong>context,cn=acme,cn=com");<br />

env.put(Context.SECURITY_AUTHENTICATION, "simple");<br />

env.put(Context.SECURITY_PRINCIPAL, "cn=db1aqadmin,cn=acme,cn=com");<br />

env.put(Context.SECURITY_CREDENTIALS, "welcome");<br />

url = "jdbc:oracle:thin:@sun-123:1521:db1";<br />

AQjmsFactory.registerConnectionFactory(env, "topic_conn1", url, null, "topic");<br />

13-12 <strong>Oracle</strong>9i Application Developer’s Guide - <strong>Advanced</strong> <strong>Queuing</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!