You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sexy Prague <se...@hotmail.com> on 2004/09/05 19:12:05 UTC
Connection class unknown...
Hello everybody,
I've got a problem with creating Connection object in my jsp where I'd like
to use DB.
I use JNDI and this is the code of my jsp's scriptlet:
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/TestDB");
//until this part it works perfectly, but when I add the next line, tomcat
"screams", that
//can not resolve symbol Connection... so classic error with unknown class
Connection conn;
//after previous line it doesn't work
It is strange, because I have imported the whole javax.sql.* package
Have somebody already met this problem?
Thanks in advance, Peter
_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
http://messenger.msn.cz/
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Connection class unknown...
Posted by Olivier Jolly <ol...@pcedev.com>.
Sexy Prague wrote:
> Hello everybody,
>
> I've got a problem with creating Connection object in my jsp where I'd
> like to use DB.
> I use JNDI and this is the code of my jsp's scriptlet:
>
> Context initContext = new InitialContext();
> Context envContext = (Context)initContext.lookup("java:/comp/env");
> DataSource ds = (DataSource)envContext.lookup("jdbc/TestDB");
> //until this part it works perfectly, but when I add the next line,
> tomcat "screams", that
> //can not resolve symbol Connection... so classic error with unknown
> class
> Connection conn;
> //after previous line it doesn't work
>
> It is strange, because I have imported the whole javax.sql.* package
>
Importing a package is an indicator for the compilation that the classes
there should be available in the coded class. However, you still have to
make sure that at runtime, they are effectively available.
the javax.sql package isn't available in jdk1.3, only 1.4 visibly
(checked from sun api docs). What happens is that maybe you compiled
with a 1.4 jdk and are executing tomcat with a 1.3 version.
Could you check this ?
> Have somebody already met this problem?
>
> Thanks in advance, Peter
Olivier Jolly
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org