You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Scott Kurinskas <sc...@gemstone.com> on 2006/08/22 22:26:31 UTC

DAS & JNDI requirements

Hi-
 
I'm trying to create a trivial java app that uses the tuscany data access
service to access a rdb using.  What I cannot figure out is what environment
variable or system property to I need to register?  I've modified
CompanyConfig.xml such that I've specified the dataSource attribute in the
<ConnectionInfo> element as shown below.
 
<ConnectionInfo
dataSource="jdbc:mysql://localhost/test?user=mysql&amp;password=mysql"/>
 
This obviously is not sufficient, but I'm not sure what else I'm missing.
 
Thanks,
Scott
 
DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"));
String sql = "Select * from customers where ID = " + id;
Command readCust = das.createCommand(sql);
//<----------  exception here
 
Exception:
Exception in thread "main" java.lang.RuntimeException:
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial
 at
org.apache.tuscany.das.rdb.impl.DASImpl.initializeConnection(DASImpl.java:16
2)
 at org.apache.tuscany.das.rdb.impl.DASImpl.getConnection(DASImpl.java:131)
 at
org.apache.tuscany.das.rdb.impl.DASImpl.baseCreateCommand(DASImpl.java:228)
 at org.apache.tuscany.das.rdb.impl.DASImpl.createCommand(DASImpl.java:197)
 at gemfire.example.rdb.mds.CompanyClient.testRead(CompanyClient.java:66)
 at gemfire.example.rdb.mds.CompanyMain.main(CompanyMain.java:24)