안녕하세요
톰캣에서 큐브리드 사용하기란 문서 보면서
하고 있는데 잘 안되서 질문드립니다.
현재 Tomcat 6.0.14 에서 jdbc를 이용하여 테스트 해보려고 하는데
에러가 납니다.
물론 제가 잘모르구요ㅜㅜ 잘못한게 있는거 같은데 못찾겠는데
조금만 도와주시면 안될까요..ㅜㅜ
그리고
tomcat6.0.14버젼에서 커넥션 풀을 이용한 방법 셋팅법은 바뀌지 않았는지요?
view.jsp
<%@ page contentType=\"text/html; charset=euc-kr\" %>
<%@ page import = \"java.sql.DriverManager\" %>
<%@ page import = \"java.sql.Connection\" %>
<%@ page import = \"java.sql.Statement\" %>
<%@ page import = \"java.sql.ResultSet\" %>
<%@ page import = \"java.SQLException\" %>
<table>
<tr>
<td>이름</td>
<td>아이디</td>
<td>이메일</td>
</tr>
<%
Class.forName(\"cubrid.jdbc.driver.CUBRIDDriver\");
Connection Conn = null;
Statement stmt = null;
ResultSet rs = null;
try
{
String jdbcDrv = \"jdbc:CUBRID:localhost:33000:demodb:::\";
String dbUsr = \"kdnmih\";
String dbPw = \"qwer\";
conn = DriverManager.getConnection(jdbcDrv, dbUsr, dbPw);
stmt = conn.createStatement();
query = \"select * from bed_and_breakfast\";
rs = stmt.executeQuery(query);
while (rs.next())
{
%>
<tr>
<td>country</td>
<td><%= rs.getString(\"country\") %></td>
<td>cost</td>
<td><%= rs.getString(\"cost\") %></td>
</tr>
<tr>
<td>rating</td>
<td><%= rs.getString(\"rating\") %></td>
<td>owner</td>
<td><%= rs.getString(\"owner\") %></td>
</tr>
<%
}
}
catch (SQLException ex)
{
// 에러발생
}
finally
{
if (rs != null) try { rs.close(); } catch (SQLException ex) {}
if (stmt != null) try { stmt.close(); } catch (SQLException ex) {}
if (conn != null) try { conn.close(); } catch (SQLException ex) {}
}
%>
<tr>
<td></td>
</tr>
</table>
------------------------------ 에러내용------------------------------------
type Exception report
message
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: 10 in the generated java file
Only a type can be imported. java.SQLException resolves to a package
An error occurred at line: 27 in the jsp file: /view_bed.jsp
conn cannot be resolved
24: String dbUsr = \"kdnmih\";
25: String dbPw = \"qwer\";
26:
27: conn = DriverManager.getConnection(jdbcDrv, dbUsr, dbPw);
28: stmt = conn.createStatement();
29:
30: query = \"select * from bed_and_breakfast\";
An error occurred at line: 28 in the jsp file: /view_bed.jsp
conn cannot be resolved
25: String dbPw = \"qwer\";
26:
27: conn = DriverManager.getConnection(jdbcDrv, dbUsr, dbPw);
28: stmt = conn.createStatement();
29:
30: query = \"select * from bed_and_breakfast\";
31: rs = stmt.executeQuery(query);
An error occurred at line: 30 in the jsp file: /view_bed.jsp
query cannot be resolved
27: conn = DriverManager.getConnection(jdbcDrv, dbUsr, dbPw);
28: stmt = conn.createStatement();
29:
30: query = \"select * from bed_and_breakfast\";
31: rs = stmt.executeQuery(query);
32:
33: while (rs.next())
An error occurred at line: 31 in the jsp file: /view_bed.jsp
query cannot be resolved
28: stmt = conn.createStatement();
29:
30: query = \"select * from bed_and_breakfast\";
31: rs = stmt.executeQuery(query);
32:
33: while (rs.next())
34: {
An error occurred at line: 51 in the jsp file: /view_bed.jsp
SQLException cannot be resolved to a type
48: <%
49: }
50: }
51: catch (SQLException ex)
52: {
53: // 에러발생
54: }
An error occurred at line: 57 in the jsp file: /view_bed.jsp
SQLException cannot be resolved to a type
54: }
55: finally
56: {
57: if (rs != null) try { rs.close(); } catch (SQLException ex) {}
58: if (stmt != null) try { stmt.close(); } catch (SQLException ex) {}
59: if (conn != null) try { conn.close(); } catch (SQLException ex) {}
60: }
An error occurred at line: 58 in the jsp file: /view_bed.jsp
SQLException cannot be resolved to a type
55: finally
56: {
57: if (rs != null) try { rs.close(); } catch (SQLException ex) {}
58: if (stmt != null) try { stmt.close(); } catch (SQLException ex) {}
59: if (conn != null) try { conn.close(); } catch (SQLException ex) {}
60: }
61:
An error occurred at line: 59 in the jsp file: /view_bed.jsp
conn cannot be resolved
56: {
57: if (rs != null) try { rs.close(); } catch (SQLException ex) {}
58: if (stmt != null) try { stmt.close(); } catch (SQLException ex) {}
59: if (conn != null) try { conn.close(); } catch (SQLException ex) {}
60: }
61:
62: %>
An error occurred at line: 59 in the jsp file: /view_bed.jsp
conn cannot be resolved
56: {
57: if (rs != null) try { rs.close(); } catch (SQLException ex) {}
58: if (stmt != null) try { stmt.close(); } catch (SQLException ex) {}
59: if (conn != null) try { conn.close(); } catch (SQLException ex) {}
60: }
61:
62: %>
An error occurred at line: 59 in the jsp file: /view_bed.jsp
SQLException cannot be resolved to a type
56: {
57: if (rs != null) try { rs.close(); } catch (SQLException ex) {}
58: if (stmt != null) try { stmt.close(); } catch (SQLException ex) {}
59: if (conn != null) try { conn.close(); } catch (SQLException ex) {}
60: }
61:
62: %>
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
|