I am trying to use a datasource, setup in WSAD 5.1.0 with
mysql-connector-java-3.0.10-stable, to connect to a windows version of
mysql (4.0.17). Unfortunately, I am geting a
java.lang.ClassCastException: javax.naming.Reference error when
casting the returning JNDI object into a javax.sql.DataSource.

Please see this url for an screen capture of the Data source dialog
within WSAD:
http://members.cox.net/ckeilitz/wsadds.jpg

Please see this url for a screen capture of the JNDI
(dumpNameSpace.bat). Notice that the object appears to be the name of
the database "cid". That seem strange to me:

http://members.cox.net/ckeilitz/jndi.jpg

I am pretty sure it isn't the code. It is very basic, but here it is:

public Connection getConnection()
{
Properties parms;
String user, password, initContext, dsn;
javax.naming.Context ctx;
DataSource ds;
Connection conn = null;

try
{
parms = new Properties();
user = "test";
password = "test";
initContext = "com.ibm.websphere.naming.WsnInitialContextFactory";
dsn = "jdbc/cid";
parms.setProperty(Context.INITIAL_CONTEXT_FACTORY, initContext);
ctx = new javax.naming.InitialContext(parms);
Object obj = ctx.lookup(dsn);
System.out.println("DS: " + obj.getClass());

ds = (javax.sql.DataSource)obj;
conn = ds.getConnection(user, password);
}
catch (NamingException e)
{
e.printStackTrace();
}
catch (SQLException e)
{
e.printStackTrace();
}

return conn;
}

Do you have any ideas? I am pretty sure that I am missing something
trivial. If you have any suggestions, I would truly appreciate your
feedback.

Chris (ckeilitz@hotmail.com)