What's the error it's throwing? Is the Oracle driver in your classpath?
Irfan Mohammed wrote:
>
> The strings that you have declared X1 and Y1 exist in the scope of the if
> statement only. once out of the if statement these variables no longer
> exist. if you did a println on those variables out of the if clause, you
> wouldn't see them.
>
> A solution is to define those strings as class variables. Read in the values
> from the database and assign to those variables. That way you should be
> able to see them in the jsp
>
> Irfan
>
> -----Original Message-----
> From: john doucette [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 03, 2000 3:04 AM
> To: [EMAIL PROTECTED]
> Subject: beanless connection problem
>
> Does anyone see where I'm screwing this up?
> I've tried several examples, to no avail.
>
> Any help would be great!
>
> Using:
> Apache on Solaris 2.6
> Oracle 8i(8.1.6)
> Jdk 1.2.2
> Jrun 2.3.3
>
> Oracle is on the same machine as the webserver
>
> //Begin Code
> <%@ page import="java.sql.*" %>
> <%@ page import="java.io.*"%>
> <%@ page import="java.util.*"%>
> <%@ page import="java.sql.*"%>
> <%@ page import="javax.servlet.*"%>
> <%@ page import="javax.servlet.http.*"%>
>
> <%
> try{
>
> Class.forName("oracle.jdbc.driver.OracleDriver");
>
> String url = "jdbc:oracle:[EMAIL PROTECTED]:1521:ora1";
> String query = "Select * from STATUS";
>
> Connection con = DriverManager.getConnection(url, "usernm",
> "paswd");
> Statement stmt = con.createStatement();
>
> ResultSet results = stmt.executeQuery(query);
>
> if (results.next()){
> String X1 = results.getString("sor_status");
> String Y1 = results.getString("SDefinition");
> }
> String X1 = "OW";
> String Y1 = "dat hurt";
> con.close();
> }
>
> catch (ClassNotFoundException e) {
> System.err.println("no driver");
> }
>
> catch (SQLException e) {
> System.err.println("no db connection");
> }
>
> finally {
> try { if (con != null) con.close(); }
> catch (SQLException e) {}
>
> }
> %>
> <HTML>
>
> <BODY>
> type:<%=X1%> Definied:<%=Y1%><BR><BR>
> </BODY>
> </HTML>
>
> John Doucette - 818.865.1310
> ----------------------------------------------------
> internet development
> sdr technologies
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets