From: Alan M. <ala...@bt...> - 2001-07-10 21:54:27
|
RE: [JBoss-user] trying to look up a datasource what am i doing wrong?There are three steps to keeping an Oracle data source. 1) Copy the oracle classes12.zip to %JBOSS_HOME%/lib/ext directory 2) Edit the jboss.jcml file with entries something like <!-- JDBC --> <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider"> <attribute name="Drivers">oracle.jdbc.driver.OracleDriver</attribute> </mbean> <mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=OracleDB"> <attribute name="PoolName">OracleDB</attribute> <attribute name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImp l</attribute> <attribute name="URL">jdbc:oracle:thin:@localhost:1521:ORACLE</attribute> <attribute name="JDBCUser">scott</attribute> <attribute name="Password">tiger</attribute> </mbean> NB this file is in the %JBOSS_HOME%/conf/tomcat if you are using jboss with tomcat 3) Instantiate a Datasource class. InitialContext jndiContext = new InitialContext(); javax.sql.DataSource source = (javax.sql.DataSource)jndiContext.lookup("java:/OracleDB"); -----Original Message----- From: jbo...@li... [mailto:jbo...@li...]On Behalf Of Jord Sonneveld Sent: 10 July 2001 22:17 To: jbo...@li... Subject: RE: [JBoss-user] trying to look up a datasource what am i doing wrong? I have in jboss.jcml: <mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=Oracle"> <attribute name="PoolName">Oracle</attribute> etc. etc. etc. </mbean> In my bean code, I do: DataSource ds; ds=(DataSource) ( ( new InitialContext() ).lookup("java:/Oracle") ); What is the exception that you get? -----Original Message----- From: Larry Kim [mailto:LarryKim@Wellogic.com] Sent: Tuesday, July 10, 2001 5:07 PM To: jbo...@li... Subject: [JBoss-user] trying to look up a datasource what am i doing wrong? this is my client: try { InitialContext initialContext = new InitialContext(); Object ref = initialContext.lookup( "DefaultDS"); // i have also tried "java:/DefaultDS" //that line causes an exception. I also tried: //DataSource ds = (DataSource)PortableRemoteObject.narrow(ref, DataSource.class); //DataSource datasource = (DataSource) initialContext.lookup("java:/DefaultDS"); } catch (NamingException ne) { System.out.println("monster Booooyaaa!!! :( :( :("); System.out.println(ne); } _______________________________________________ JBoss-user mailing list JBo...@li... http://lists.sourceforge.net/lists/listinfo/jboss-user |