<%@ page import="java.sql.*"%>
<%!
String DBDRIVER = "oracle.jdbc.driver.OracleDriver" ;
String DBURL = "jdbc:oracle:thin:@localhost:1521:ORCL" ;
String nam="chenyu";
String conten="hello world!!!";
String sql="insert into message values(?,?)";
%>
<%
Connection conn=null;
Class.forName(DBDRIVER);
conn = DriverManager.getConnection(DBURL,"scott","scott");
PreparedStatement stmt=conn.PrepareStatement("select * from message");
//stmt.setString(1,nam);
//stmt.setString(2,conten);
conn.close();
%>提示错误:
An error occurred at line: 15 in the jsp file: /test/test.jsp
The method PrepareStatement(String) is undefined for the type Connection
12: Connection conn=null;
13: Class.forName(DBDRIVER);
14: conn = DriverManager.getConnection(DBURL,"scott","scott");
15: PreparedStatement stmt=conn.PrepareStatement("select * from message");
16: //stmt.setString(1,nam);
17: //stmt.setString(2,conten);
18: conn.close();求解怎样修改,在线等
<%!
String DBDRIVER = "oracle.jdbc.driver.OracleDriver" ;
String DBURL = "jdbc:oracle:thin:@localhost:1521:ORCL" ;
String nam="chenyu";
String conten="hello world!!!";
String sql="insert into message values(?,?)";
%>
<%
Connection conn=null;
Class.forName(DBDRIVER);
conn = DriverManager.getConnection(DBURL,"scott","scott");
PreparedStatement stmt=conn.PrepareStatement("select * from message");
//stmt.setString(1,nam);
//stmt.setString(2,conten);
conn.close();
%>提示错误:
An error occurred at line: 15 in the jsp file: /test/test.jsp
The method PrepareStatement(String) is undefined for the type Connection
12: Connection conn=null;
13: Class.forName(DBDRIVER);
14: conn = DriverManager.getConnection(DBURL,"scott","scott");
15: PreparedStatement stmt=conn.PrepareStatement("select * from message");
16: //stmt.setString(1,nam);
17: //stmt.setString(2,conten);
18: conn.close();求解怎样修改,在线等
An error occurred at line: 15 in the jsp file: /test/test.jsp
An error occurred at line: 15 in the jsp file: /test/test.jsp
The method PrepareStatement(String) is undefined for the type Connection
12: Connection conn=null;
13: Class.forName(DBDRIVER);
14: conn = DriverManager.getConnection(DBURL,"scott","scott");
15: PreparedStatement stmt=conn.PrepareStatement("select * from message"); //p是小写的 conn.prepareStatement("select * from message");
conn.PrepareStatement("select * from message");conn.prepareStatement