Thank you very much for the explanation ! I am starting to understand it much better. Thank you everybody
----- Original Message ----- From: "Parsons Technical Services" <[EMAIL PROTECTED]> To: "Tomcat Users List" <tomcat-user@jakarta.apache.org> Sent: Friday, February 25, 2005 1:20 AM Subject: Re: Very Straneg problem with MySQL-Connector > For networking localhost=127.0.0.1=monkinetwork > > But when you attach to the database it sends the machine name in Linux and > under MySQL localhost<>127.0.0.1<>monkinetwork and so you have to put in the > location that is identified. When your app talks to MySQL, it tells MySQL it > is calling from machine X, in your case the machine name is monkinetwork. > Had you not named the machine it would have sent localhost if it was bound > to the loopback address. And if that was not bound it would have sent the > 127.0.0.1. You may also want to watch that if you bind Tomcat to an IP it > may send that IP to MySQL if the machine name is not available. When you go > across the network it will also use the IP of the machine. The easy way to > tell is from the error. > > "Access denied for user 'root'@'monkinetwork' (using password: YES)" > > You were running Tomcat as root and the machine name is monkinetwork. > > Hope this helps. > > Doug > > > ----- Original Message ----- > From: "monkiboy" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <tomcat-user@jakarta.apache.org> > Sent: Thursday, February 24, 2005 5:04 PM > Subject: Re: Very Straneg problem with MySQL-Connector > > > > Thank you for trying to help me everybody ! > > I read carefully your answer and it look like I have problem with > > privileges. My problem is resolved ! > > The first thing I did is : > > Comment this line on "my.cnf" file : # bind 127.0.0.1 > > Then the second thing that I made (with your advice) : is to try to > > connect > > on MySQL with User and not with the root. > > > > GRANT ALL PRIVILEGES ON testdb.* to 'test'@'localhost' IDENTIFIED BY > > 'test'; > > Doesn't work but when I did that : > > GRANT ALL PRIVILEGES ON testBDD.* to 'test'@'monkinetwork' IDENTIFIED BY > > 'test'; > > It's worked. > > It's look like I had to grant privilege on monkinetwork... It's very > > strange > > and I can't understand, I don't know why I had to do that... > > > > Best Regards. > > monkiboy > > > >> OK, the problem normally does not come from the driver, just try this: > >> from your freshly installed MySQL database, remove the test database and > >> also the test user from the database permissions table and from any > >> global user definitions, then flush-privileges and you should be ready > >> to go. > >> > >> Drew. > >> > >> > >> On Thu, 2005-02-24 at 03:01, monkiboy wrote: > >> > Hi everybody! > >> > I have a weird problem to use the MySQL-connector under Linux (Debian). > > I heard it can come from Tomcat. > >> > I have no problem in windows XP, all is working fine ! > >> > But under Linux when I try to connect to mysql throught mysql-connector > > wrote in a Servlet I have this message : > >> > > >> > Message: Invalid authorization specification message from server: > > "Access denied for user 'root'@'monkinetwork' (using password: YES)" > >> > SQLState: 28000 > >> > ErrorCode: 1045 > >> > > >> > I am Using : Tomcat 5.0.28 > >> > MySQL-Connector version is : mysql-connector-java-3.0.15-ga-bin.jar > >> > > >> > JDK Version : 1_5_0_01. Servlet-Examples and JSP works fine! So I don't > > think the problem come from JDK. > >> > > >> > MySQL version : MySQL-SERVER-4.1.9-2 : All is working under console > >> > mode > > ! > >> > > >> > Here's My Servlet TESt1.java: > >> > > >> > > >> > Code: > >> > > >> > > >> > import java.io.*; > >> > import javax.servlet.*; > >> > import javax.servlet.http.*; > >> > import java.sql.*; > >> > import java.sql.DriverManager; > >> > > >> > public class TEST1 extends HttpServlet { > >> > public void doGet(HttpServletRequest request, HttpServletResponse > > response) > >> > throws ServletException, IOException { > >> > > >> > response.setContentType("text/html"); > >> > PrintWriter out = response.getWriter(); > >> > > >> > String url = "jdbc:mysql://localhost:3306/HeroDB"; > >> > String user = "root"; > >> > String password = "password"; > >> > > >> > try{ > >> > Class.forName("com.mysql.jdbc.Driver"); > >> > out.println("<br> DRIVERS JDBC : OK!"); > >> > Connection connection = > > DriverManager.getConnection(url,user,password); > >> > > >> > out.println("<br> Database connection : OK!"); > >> > > >> > } > >> > catch (ClassNotFoundException e) > >> > { > >> > out.println("Error with JDBC Drivers !"); > >> > } > >> > catch(SQLException ex) { > >> > > >> > > >> > out.println("<br> ERROR MESSAGE <br>"); > >> > while (ex != null) { > >> > > >> > out.println("<br>Message: " + ex.getMessage ()); > >> > > >> > out.println("<br>SQLState: " + ex.getSQLState ()); > >> > > >> > out.println("<br>ErrorCode: " + ex.getErrorCode ()); > >> > > >> > ex = ex.getNextException(); > >> > out.println(""); > >> > } > >> > } > >> > > >> > > >> > } > >> > } > >> > > >> > > >> > > >> > AND THE HTML PAGE in order to access to the Servlet : > >> > > >> > Code: > >> > > >> > <HTML> > >> > <HEAD> > >> > <TITLE>DataBase Test</TITLE> > >> > </HEAD> > >> > <BODY BGCOLOR="#FDF5E6"> > >> > <H2 ALIGN="CENTER">DataBase TEST</H2> > >> > > >> > <FORM ACTION="http://localhost:8080/TEST1"> > >> > <CENTER> > >> > <INPUT TYPE="SUBMIT" VALUE = "CONNEXION TEST"> > >> > </CENTER> > >> > </FORM> > >> > > >> > </BODY> > >> > </HTML> > >> > > >> > Theses codes works very well under windows, but under linux system here > > what I've got : > >> > > >> > DRIVERS JDBC : OK! > >> > ERROR MESSAGE > >> > Message: Invalid authorization specification message from server: > > "Access denied for user 'root'@'monkinetwork' (using password: YES)" > >> > SQLState: 28000 > >> > ErrorCode: 1045 > >> > > >> > Well, the web.xml file is well configured. > >> > > >> > Anyway : I already tried with class: org.gjt.mm.mysql.driver, but I > >> > have > > the same message error ! > >> > > >> > By the way, it's very strange that I can play with MySQL under the > > terminal but not throught tomcat. > >> > Any suggestions please , because it's giving me a very hard time ! ? > >> > Thank you ! > >> > ++ > >> > monkiboy > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]