File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes datamining jndi connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "datamining jndi connection" Watch "datamining jndi connection" New topic

datamining jndi connection

vasanthi naveen

Joined: Oct 31, 2008
Posts: 10
iam getting the following error while connecting mysql with java for datamining.

java.lang.ClassCastException: org.apache.commons.dbcp.BasicDataSource

my code is:


title DB Test title

<%<br /> foo.MarketBasket tst = new foo.MarketBasket();<br /> tst.init();<br /> %>

public void init()throws JDMException,NamingException, SQLException
Context ctx = new InitialContext();
System.out.println("after initial context");
javax.datamining.resource.ConnectionFactory jdmCFactory =
(ConnectionFactory) ctx.lookup("java:comp/env/jdbc/TestDB");
ConnectionSpec svrConnSpec = (javax.datamining.resource.ConnectionSpec)
System.out.println("got connection1");
svrConnSpec.setName( "username" );
svrConnSpec.setPassword( "password" );
svrConnSpec.setURI( "url" );
m_dmeConn = jdmCFactory.getConnection( svrConnSpec );
System.out.println("connection got");


<Context path="/Databasemining" reloadable="true" docBase="D:\vasanthi\dataminingworkspace\Databasemining" workDir="D:\vasanthi\dataminingworkspace\Databasemining\work" >
< !--<Context path="/DBTest" docBase="DBTest"<br /> debug="5" reloadable="true" crossContext="true">-->

<Resource name="jdbc/TestDB"<br /> auth="Container"<br /> type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/TestDB">

< !-- Maximum number of dB connections in pool. Make sure you<br /> configure your mysqld max_connections large enough to handle<br /> all of your db connections. Set to 0 for no limit.<br /> -->

< !-- Maximum number of idle dB connections to retain in pool.<br /> Set to 0 for no limit.<br /> -->

< !-- Maximum time to wait for a dB connection to become available<br /> in ms, in this example 10 seconds. An Exception is thrown if<br /> this timeout is exceeded. Set to -1 to wait indefinitely.<br /> -->

< !-- MySQL dB username and password for dB connections -->

< !-- Class name for mm.mysql JDBC driver -->
what may be the possible fault.i have included all the jars ie commons.commons-dbcp-1.2.2,jdm jar,mysql jar and all.
its urgent.please reply for this request.thanks in advance.
ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
where is my original topic here?
A layman's doubt on build
Paul Yule
Ranch Hand

Joined: May 12, 2008
Posts: 229
it ended up being moved to the Ant/Maven/Other build tools forum instead of where the link sent us. I don't know if the error can be fixed.

P.S. Vasanthi: Sorry for the hi-jack.
I agree. Here's the link:
subject: datamining jndi connection
It's not a secret anymore!