| Oracle8i CORBA Developer's Guide and Reference Release 3 (8.1.7) Part Number A83722-01 |
|
If you want to bind only a single DataSource object in the namespace to be used for multiple database resources, you must do the following:
DataSource without specifying the URL, host, port, SID, or driver type. Thus, you execute the bindds tool with only the -dstype jta option, as follows:
sess_sh -service jdbc:oracle:thin:@nsHost:5521:ORCL -user SCOTT -password TIGER & bindds /test/empDatabase -dstype jta
DataSource in your code. When you perform the lookup, you must cast the returned object to OracleJTADataSource instead of DataSource. The Oracle-specific version of the DataSource class contains methods to set the DataSource properties.
OracleJTADataSource.setURL method
OracleJTADataSource methods: setURL, setDatabaseName, setPortNumber, and setDriverType
OracleJTADataSource.setDBLink method
getConnection method. However, if you want to set it with the OracleJTADataSource methods, you can through the setUser and setPassword methods.
OracleJTADataSource.getConnection method as indicated in the other examples.
The following example retrieves a generically bound DataSource from the namespace using in-session lookup and initializes all relevant fields.
//retrieve an in-session generic DataSource object OracleJTADataSource ds = (OracleJTADataSource)ic.lookup ("/test/genericDS"); //set all relevant properties for my database //URL is for a local database so use the KPRB URL ds.setURL ("jdbc:oracle:kprb:"); //Used in two-phase commit, so provide the fully qualified database link that //was created from the two-phase commit engine to this database ds.setDBLink("localDB.oracle.com"); //Finally, retrieve a connection to the local database using the DataSource Connection conn = ds.getConnection ();
|
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|