You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Peter Shankey <sh...@its.charlestoncounty.org> on 2001/09/17 23:02:39 UTC

JSP page to Oracle with Tomcat all files

Not sure why all the attachments did not come through but here goes 
again:

Tomcat 4.0 b7
Solaris 8
Oracle 8.1.7

I am trying to perform a Oracle DB query from a jsp page. I have included 
the web.xml file the jsp page "fwtst.jsp" and the error message I am 
having returned to me from the query.
I believe the problem is that I do not know how to make system 
environments known to JSP or Tomcat. This is because of the error I am 
getting which is "javax.servlet.ServletException: ORA-12154: TNS:could 
not resolve service name  at so on and so on"

>From my Oracle experience I know this error typically mean you are using 
the wrong  DB alias or  an environment variable such as ORACLE_HOME or 
TNS_ADMIN is not set or is incorrect. 

Before I start Tomcat I have checked and re-checked my ability to run 
sqlplus and connect to the DB but from the JSP page I cannot.

My questions are 
Can I set environmental variables such as ORACLE_HOME in the JSP.  If so 
how? please give a short example
Can I use one of  Tomcat's files such as web.xml or server. xml ??
Can I use one of the web-appliation files such as web.xml??

Thanks
Pete

Re: JSP page to Oracle with Tomcat all files

Posted by "P.Miller" <p....@brocom.de>.
Hi Huaxin,

what has UserId and password to do withthe URL?
for example if you take a datasource:

String strURL = "jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:ORCL"
String strPassword = "xxxx"
String strUserID = "xxx"
oraDs = new OracleConnectionPoolDataSource();
oraDs.setURL(strURL);
oraDs.setPassword(strPassword);
oraDs.setUser(strUserID);

now you're ready to get a connection.
Oracle Database needs the port and the DB-name in the URL I think!?
Peter

Huaxin wrote:
> 
> Just curious on the URL you've mentioned, how can you
> append the userid and passwd after the jdbc:oracle:thin:@xxx.x things?
> 
> i know the format for cloud DB, i am wondering it for oracle only
> 
> On Tue, 18 Sep 2001, P.Miller wrote:
> 
> > Hi Peter,
> >
> > I put the IP-Adress after the '@' and use the 'thin' driver instead of
> > the 'oci8'.
> > Also you have to put the port# on which the Listener waits for calls.
> > In most cases it's the 1521.
> > And the name of your Database ORCL or something else
> > So the string should look like :
> > jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:ORCL
> > plus userid and password.
> >
> > Hth
Peter

Re: JSP page to Oracle with Tomcat all files

Posted by Huaxin <hx...@cs.ualberta.ca>.
Just curious on the URL you've mentioned, how can you
append the userid and passwd after the jdbc:oracle:thin:@xxx.x things?

i know the format for cloud DB, i am wondering it for oracle only

On Tue, 18 Sep 2001, P.Miller wrote:

> Hi Peter,
>
> I put the IP-Adress after the '@' and use the 'thin' driver instead of
> the 'oci8'.
> Also you have to put the port# on which the Listener waits for calls.
> In most cases it's the 1521.
> And the name of your Database ORCL or something else
> So the string should look like :
> jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:ORCL
> plus userid and password.
>
> Hth
>
> Peter
> >
> > Not sure why all the attachments did not come through but here goes
> > again:
> >
> > Tomcat 4.0 b7
> > Solaris 8
> > Oracle 8.1.7
> >
> > I am trying to perform a Oracle DB query from a jsp page. I have included
> > the web.xml file the jsp page "fwtst.jsp" and the error message I am
> > having returned to me from the query.
> > I believe the problem is that I do not know how to make system
> > environments known to JSP or Tomcat. This is because of the error I am
> > getting which is "javax.servlet.ServletException: ORA-12154: TNS:could
> > not resolve service name  at so on and so on"
> >
> > >From my Oracle experience I know this error typically mean you are using
> > the wrong  DB alias or  an environment variable such as ORACLE_HOME or
> > TNS_ADMIN is not set or is incorrect.
> >
> > Before I start Tomcat I have checked and re-checked my ability to run
> > sqlplus and connect to the DB but from the JSP page I cannot.
> >
> > My questions are
> > Can I set environmental variables such as ORACLE_HOME in the JSP.  If so
> > how? please give a short example
> > Can I use one of  Tomcat's files such as web.xml or server. xml ??
> > Can I use one of the web-appliation files such as web.xml??
> >
> > Thanks
> > Pete
> >
> >   ------------------------------------------------------------------------
> >                    Name: files.tar
> >    files.tar       Type: Unix Tape Archive (application/x-tar)
> >                Encoding: base64
> >             Description: filename="files.tar"
>


Re: JSP page to Oracle with Tomcat all files

Posted by "P.Miller" <p....@brocom.de>.
Hi Peter,

I put the IP-Adress after the '@' and use the 'thin' driver instead of
the 'oci8'. 
Also you have to put the port# on which the Listener waits for calls. 
In most cases it's the 1521.
And the name of your Database ORCL or something else
So the string should look like :
jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:ORCL
plus userid and password.

Hth

Peter
> 
> Not sure why all the attachments did not come through but here goes
> again:
> 
> Tomcat 4.0 b7
> Solaris 8
> Oracle 8.1.7
> 
> I am trying to perform a Oracle DB query from a jsp page. I have included
> the web.xml file the jsp page "fwtst.jsp" and the error message I am
> having returned to me from the query.
> I believe the problem is that I do not know how to make system
> environments known to JSP or Tomcat. This is because of the error I am
> getting which is "javax.servlet.ServletException: ORA-12154: TNS:could
> not resolve service name  at so on and so on"
> 
> >From my Oracle experience I know this error typically mean you are using
> the wrong  DB alias or  an environment variable such as ORACLE_HOME or
> TNS_ADMIN is not set or is incorrect.
> 
> Before I start Tomcat I have checked and re-checked my ability to run
> sqlplus and connect to the DB but from the JSP page I cannot.
> 
> My questions are
> Can I set environmental variables such as ORACLE_HOME in the JSP.  If so
> how? please give a short example
> Can I use one of  Tomcat's files such as web.xml or server. xml ??
> Can I use one of the web-appliation files such as web.xml??
> 
> Thanks
> Pete
> 
>   ------------------------------------------------------------------------
>                    Name: files.tar
>    files.tar       Type: Unix Tape Archive (application/x-tar)
>                Encoding: base64
>             Description: filename="files.tar"