Thanks for the info. I'm not actually calling a bean, just want a
DataSource. So, there is no ejb-jar.xml to change. This is a client
app.
The following lookups generate a naming exception:
java:/comp/env/Hypersonic (I think your leading / was a typo)
java:comp/env/Hypersonic
java:comp/env/jdbc/Hypersonic
java:Hypersonic doesn't generate a naming exception, but the class cast
exception below.
Thanks again.
Sean
--- Aaron Mulder <[EMAIL PROTECTED]> wrote:
> Use the JNDI name "java:/comp/env/Hypersonic". Be sure to declare
> the data source in your ejb-jar.xml file for that bean.
>
> Aaron
>
> On Mon, 18 Sep 2000, Sean O'Connor wrote:
> > I am trying to write a "hello world" type client app that connects
> to
> > the default Hypersonic database. The result when I try to cast to
> the
> > DataSource is the following exception. I know it's finding
> > "Hypersonic", if I change that, I'll get a naming exception.
> >
> > Exception: java.lang.ClassCastException: javax.naming.Reference
> >
> > Any ideas why? Everything looks ok to me. Here's the source.
> >
> > Thanks.
> > Sean
> >
> > import java.sql.*;
> > import javax.sql.*;
> > import java.util.*;
> > import javax.ejb.*;
> > import javax.naming.*;
> >
> > public class DBBoss {
> >
> > public static void main(String[] args) {
> >
> > String sql = "create table test ( column1 integer )";
> >
> > try {
> > Context ctx = new InitialContext();
> >
> > DataSource ds = (DataSource) ctx.lookup("java:Hypersonic");
> > Connection con = ds.getConnection();
> >
> > Statement stmt = con.createStatement();
> > stmt.execute(sql);
> > stmt.close();
> > con.close();
> > } catch (Exception se) {
> > System.out.println("Exception: " + se);
> > }
> > }
> > }
> >
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Mail - Free email you can access from anywhere!
> > http://mail.yahoo.com/
> >
> >
> > --
> > --------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> > Problems?: [EMAIL PROTECTED]
> >
>
>
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
>
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]