N
nowy84
// Forgive my English
I have to write a program (JS or JSP), which connect with Oracle and
get out date from some table. I've found some example, but it makes
errors (
I installed these :
J2EE 5.0
Tomcat 5.5.17
Oracle Express Edition 10.2g
I put ojdbc14.jar in in folder, where is my .jsp file.
Source of .jsp :
<%
Class.forName("oracle.jdbc.driver.OracleDriver");
java.sql.Connection
connection=java.sql.DriverManager.getConnection("jdbc:
oracle:thin//localhost:3306/"baza","login","haslo");
java.sql.ResultSet rs=connection.createStatement().executeQuery("select
* from
$TableName");
out.println("col count is "+rs.getMetaData().getColumnCount());
String colName=rs.getMetaData().getColumnLabel(1);
out.println("col label is "+colName);
while(rs.next()){
Object o=rs.getObject(colName);
out.println(colName+" "+o);
}
%>
Errors :
description The server encountered an internal error () that prevented
it from
fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /moja/baza2.jsp
Generated servlet error:
Syntax error on tokens, delete these tokens
org.apache.jasper.servlet.JspServletWrapper.
handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /moja/baza2.jsp
Generated servlet error:
Syntax error on tokens, delete these tokens
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.
java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.
5.17 logs.
I have to write a program (JS or JSP), which connect with Oracle and
get out date from some table. I've found some example, but it makes
errors (
I installed these :
J2EE 5.0
Tomcat 5.5.17
Oracle Express Edition 10.2g
I put ojdbc14.jar in in folder, where is my .jsp file.
Source of .jsp :
<%
Class.forName("oracle.jdbc.driver.OracleDriver");
java.sql.Connection
connection=java.sql.DriverManager.getConnection("jdbc:
oracle:thin//localhost:3306/"baza","login","haslo");
java.sql.ResultSet rs=connection.createStatement().executeQuery("select
* from
$TableName");
out.println("col count is "+rs.getMetaData().getColumnCount());
String colName=rs.getMetaData().getColumnLabel(1);
out.println("col label is "+colName);
while(rs.next()){
Object o=rs.getObject(colName);
out.println(colName+" "+o);
}
%>
Errors :
description The server encountered an internal error () that prevented
it from
fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /moja/baza2.jsp
Generated servlet error:
Syntax error on tokens, delete these tokens
org.apache.jasper.servlet.JspServletWrapper.
handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /moja/baza2.jsp
Generated servlet error:
Syntax error on tokens, delete these tokens
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.
java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.
5.17 logs.