Erro na linha 4.. me ajudem

2 respostas
F
bom... estou tentando fazer um trabalho aqui e não consigo rodar dá o seguinte erro:
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 4 in the jsp file: /index.jsp
Generated servlet error:
C:\Documents and Settings\Administrador\.netbeans.1ea2\jakarta-tomcat-5.0.28_base\work\Catalina\localhost\testweb\org\apache\jsp\index_jsp.java:52: cannot find symbol
symbol  : method CreateStatement()
location: interface java.sql.Connection
Statement stm = con.CreateStatement();
                   ^
1 error



	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
	org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
o código seria esse:
<%@ page import="java.sql.*"%>
<html><body>
<b>Seus usuários são:</b><br>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(
        "jdbc:mySQL://localhost:3306/mySQL?useUnicode=true",
        "root",
        "root");
Statement stm = con.CreateStatement();
ResultSet res = stm.executeQuery("select user from user");
while (res.next()) {
    out.println(res.getString(1)+"<br>");
}
res.close();
%>
</body></html>

2 Respostas

furutani

Olá
Provavelmente o “c” do createStatement na linha Statement stm = con.CreateStatement();
é minusculo
o correto seria

Statement stm = con.createStatement();
F

aee
valeu!!
funcionou direitinho aqui
brigadão mesmo

Criado 12 de agosto de 2006
Ultima resposta 13 de ago. de 2006
Respostas 2
Participantes 2