com.sun.appserv package does not exist

Hello!

I am trying to access a jdbc resource through the code snippet:

private com.sun.appserv.DataSource getMyDatabase() throws javax.naming.NamingException {

javax.naming.Context c = new javax.naming.InitialContext();

//return (javax.sql.DataSource) c.lookup("java:comp/env/jdbc/myDatabase");

com.sun.appserv.DataSource ds = (com.sun.appserv.DataSource) c.lookup("jdbc/datasource_1");

return ds;

}

This returns an error "Package com.sun.appserv" does not exist.

Could someone help me on this issue please?

Thank you!

[585 byte] By [podibuhaa] at [2007-11-26 6:28:39]
# 1

Is there any specific reason to use appserv.jdbc.DataSource?

You can add appserv-rt.jar, appserv-ext.jar to your classpath so as to get access appserv.jdbc.DataSource. (This mode is usually not advisable)

You need not use com.sun.appserv.jdbc.DataSource. javax.sql.DataSource can be used.

Thanks,

-Jagadish

JagadishPrasath at 2007-7-6 14:23:15 > top of Java-index,Application & Integration Servers,Application Servers...