I thought that I should report -- I finally got this working. It turns out that the problem
was that I had the jdbc-se2.0.jar file on my classpath. As soon as I removed this it works perfectly.
Strange but I am not complaining. I think the documentation says we need that, but it should not say that.
Melanie (Miho) Tanaka
Werner Guttmann <[EMAIL PROTECTED]>wrote:
All right, last resort ... can you somehow send me the settings for the connection pool definition. If you are using WS403de, this cooul dbe found in server-cfg.xml. Other than this, can you access your DataSource from a plain servlet where you manually code the JNDI lookup and use JDBC calls to open connections ?Werner
Melanie Tanaka wrote:
Hi Werner,Yes, I did define this reference in my web.xml. I have:
<resource-ref id="ResourceRef_1">
<description>jdbc/MyDB</description>
<res-ref-name>jdbc/MyDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>CONTAINER</res-auth>
</resource-ref>
What do you think?
Melanie (Miho) Tanaka
Werner Guttmann <[EMAIL PROTECTED]>wrote:
Melanie,did you define the resource reference for your WebSphere connection pool in your deployment descriptor, iow do you have a statement similar to
<resource-ref>
<description>Sample DataSource to access SpiderAdmin database</description>
<res-ref-name>jdbc/spiderAdmin</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>in your web.xml so that the connection pool you have defined in WebSphere gets made available to your web app and its local JNDI namespace. Without this, your DataSource will not be available in "java:com/env" ..
I hope this helps.
Werner
Melanie Tanaka wrote:
When I use this mapping:<database name="MyDB" engine="db2" >
<jndi name="java:comp/env/jdbc/MyDB" />
<mapping href="User.xml" />
</database>OR this mapping:
<database name="MyDB" engine="db2" >
<jndi name="jdbc/MyDB" />
<mapping href="User.xml" />
</database>
I get this error:
org.exolab.castor.mapping.MappingException: The JNDI name java:comp/env/jdbc/MyDB does not map to a JDBC DataSource
[9/5/02 13:19:52:686 EDT] 6fd10700 SystemOut U at org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(Unknown Source)
[9/5/02 13:19:52:686 EDT] 6fd10700 SystemOut U at org.exolab.castor.jdo.JDO.loadConfiguration(Unknown Source)
When I use this mapping:
<database name="MyDB" engine="db2">
<data-source class-name="COM.ibm.db2.jdbc.DB2DataSource">
<params user="db2admin" password="password" database-name="MyDB" server-name="miho-laptop" />
</data-source>
<mapping href="User.xml" />
</database>OR:
<database name="MyDB" engine="db2">
<data-source class-name="COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource">
<params user="db2admin" password="password" database-name="MyDB" server-name="miho-laptop" />
</data-source>
<mapping href="User.xml" />
</database>I get this error:
SystemOut U java.lang.IllegalStateException: Data source class name does not extend javax.sql.DataSource
[9/5/02 13:22:59:554 EDT] 6fd10700 SystemOut U at org.exolab.castor.jdo.conf.DataSource.createParams(Unknown Source)I know the DataSource configuration works because I test it with this code:
java.sql.Connection conn = null;
try{java.util.Properties parms = new java.util.Properties();
parms.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");javax.naming.Context ctx = new javax.naming.InitialContext(parms);
javax.sql.DataSource ds =
(javax.sql.DataSource)ctx.lookup("jdbc/MyDB");conn = ds.getConnection();
System.out.println("Got connection.");
conn.close();
}catch (java.sql.SQLException sqle) {}
finally {try {
if (conn != null) conn.close();
}
catch (SQLException sqle) {}
} // end finallyBruce Snyder <[EMAIL PROTECTED]>wrote:
This one time, at band camp, Melanie Tanaka said:MT>That is exactly a problem that I am having. I _have_ correctly configured the datasource in WSAD, and when I make calls using JNDI reference it works with out the problems. But, Castor gives an error that says "Not a valid datasource". Then when I try to use database.xml just calling the ConnectionPool driver (don't go through JNDI), I get the error which says "This class does not implement javax.sqlDataSource.
Melanie,
Based on the error that you're receiving, Castor has been told to make
use of a DataSource implementation but it has been handed a Driver
implementation. Please post your database descriptor for us to view.Bruce
--
perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E
-----------------------------------------------------------
If ! you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
Do you Yahoo!?
Yahoo! News - Today's headlines
