Pessoal Estou começando a desenvolver JAVA no Linux…
Instalei o NETBEANS 4.1
Estou tentando fazer uma conexao com o BANCO DE DADOS MYSQL adicionei ao Libraries e nao vai… (testo no Mysql Control Center e esta totalmente correto o usuario e senha)
o codigo é:
<%@ page import="java.sql.*"%>
<html>
<body>
<h1>Seus usuários são</h1>
<%
Class.forName("com.mysql.jdbc.Driver");
//usuario = "usuario" e senha = "usuario"
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","usuario","usuario");
Statement stm = conn.createStatement();
ResultSet res = stm.executeQuery("Select user from users");
while(res.next())
{
out.println(res.getString(1)+"<br>");
}
res.close();
%>
e o erro é:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Access denied for user 'usuario'@'localhost.localdomain' (using password: YES)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.index_jsp._jspService(index_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
root cause
java.sql.SQLException: Access denied for user 'usuario'@'localhost.localdomain' (using password: YES)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2917)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:770)
com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3637)
com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1175)
com.mysql.jdbc.Connection.createNewIO(Connection.java:2544)
com.mysql.jdbc.Connection.<init>(Connection.java:1474)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:264)
java.sql.DriverManager.getConnection(DriverManager.java:512)
java.sql.DriverManager.getConnection(DriverManager.java:171)
org.apache.jsp.index_jsp._jspService(index_jsp.java:50)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.7 logs.
Alguem poderia me ajudar???
Abraço pessoal…
Mateus