I'm trying to make a simple connection to Oracle. I have configured Tomcat to create/connect a JDBCrealm and the connection works, or at least seems to load with no errors..
However, anytime I try to declare any variables i get the same error:
org.apache.jasper.JasperException: Unable to compile class for JSP/usr/local/jakarta-tomcat-3.2.4/work/localhost_8080/_0002ftest_0002ejsptest_jsp_13.java:19: Exception java.sql.SQLException can't be thrown in initializer.
Connection conn = DriverManager.getConnection("jdbc
racle:thin
testmachine:1521:SID", "scott", "tiger"
;
How can I fix this??? Here is the example code (which seems to be published all over the web as an example):
<%@ page language="java" import="java.sql.*" %>
<%! Connection conn = DriverManager.getConnection("jdbc
racle:thin
testmachine:1521:SID", "scott", "tiger"
;%>
Finally, make a query and display the results:
<% Statement statement =
conn.createStatement();
ResultSet resultSet =
statement.executeQuery("select * from emp"
; %>
<P> The results are:
</P>
<UL>
<% while (resultSet.next()) { %>
<LI><%= resultSet.getString(1) %></LI>
<% } >
</UL>
However, anytime I try to declare any variables i get the same error:
org.apache.jasper.JasperException: Unable to compile class for JSP/usr/local/jakarta-tomcat-3.2.4/work/localhost_8080/_0002ftest_0002ejsptest_jsp_13.java:19: Exception java.sql.SQLException can't be thrown in initializer.
Connection conn = DriverManager.getConnection("jdbc
How can I fix this??? Here is the example code (which seems to be published all over the web as an example):
<%@ page language="java" import="java.sql.*" %>
<%! Connection conn = DriverManager.getConnection("jdbc
Finally, make a query and display the results:
<% Statement statement =
conn.createStatement();
ResultSet resultSet =
statement.executeQuery("select * from emp"
<P> The results are:
</P>
<UL>
<% while (resultSet.next()) { %>
<LI><%= resultSet.getString(1) %></LI>
<% } >
</UL>