Hi,

I got the same error a few weeks ago. in my case, the URL was wrong. you use:
        jdbc:mysql://l/AdressBook
Are you sure it's right? Is 'l' really the right host? Did you tried it with the ip-address?

Best Regards,
Sebastian
On Dec 12, 2005, at 2:37 PM, marju jalloh wrote:

I went throug the permission and now I get another error

java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.SocketException: java.net.ConnectException: Connection refused
      ** BEGIN NESTED EXCEPTION **
      java.net.SocketException
      MESSAGE: java.net.ConnectException: Connection refused
      STACKTRACE:
java.net.SocketException: java.net.ConnectException: Connection refused

I don`t know if the problem is with Tomcat of the Driver of mysql server
  This is my code

  ublic class Marju extends HttpServlet {
    public void doGet(HttpServletRequest request,
                       HttpServletResponse response)
        throws ServletException, IOException {
      response.setContentType("text/html");
      PrintWriter out = response.getWriter();

   Connection conn = null;

             try
             {
                 String userName = "root";
                 String password = "";
                 String url = "jdbc:mysql://l/AdressBook";
                 Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url, userName,password);
                  out.println("Database connection established");
             }
             catch (Exception e)
             {
                  out.println("Can`t connect to database server!");
                  e.printStackTrace();
             }
             finally
             {
                 if (conn != null)
                 {
                     try
                     {
                          conn.close ();
System.out.println ("Database connection terminated");

                     }
catch (Exception e) { /* ignore close errors */ }
                 }
             }
         out.println("my first servlet");
                  }
  }
  Any help would be appreciated

  Byfour
Jan Behrens <[EMAIL PROTECTED]> wrote:  look here -->
http://dev.mysql.com/doc/refman/4.1/en/connection-access.html

rtfm ;)

marju jalloh  schrieb am 12.12.2005 13:33:54:

But how to Grant permission to an ip host


Karthik  wrote:  hI

tHE PROBLEMS IS PRESENT WITHIN THE mysql SERVER,U NEED TO GIVE
PERMISSION TO
THE ip HOST U ARE USING

TRY USING THE GRANT PERMISSION AND USE THE SAME,BUT U HAVE TO FLUSH OUT
ALL
acl PREVELIAGES AVALIABEL IN MYSQL DB

   USE A FRONT END LIKE MYSQL FRONT TO DO THIS



HOPE THIS HELPS.




WITH REGARS
kARTHIK



-----Original Message-----
From: marju jalloh [mailto:[EMAIL PROTECTED]
Sent: Monday, December 12, 2005 4:53 PM
To: Tomcat Users List
Subject: Tomcat JDBC connection with Mysql


 I can`connect to my database with via  servlet. The connection works
well
in PHP but not with servlet. I have  googled but no solution.

  this is my error page I got

  java.sql.SQLException: Data source rejected establishment of
connection,
message from server: "Host 'localhost.localdomain' is  not allowed to
connect to this MySQL server"
      at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:650)
      at com.mysql.jdbc.Connection.createNewIO(Connection.java:1808)
      at com.mysql.jdbc.Connection.(Connection.java:452)
      at

com.mysql.jdbc.NonRegisteringDriver.connect (NonRegisteringDriver.java:411)
      at java.sql.DriverManager.getConnection(DriverManager.java:525)
      at java.sql.DriverManager.getConnection(DriverManager.java:171)
      at Liep.doGet(Liep.java:30)
  ...
  ...
  Can anyone help or give me a pointer to a website

  Byfour



---------------------------------
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




                        
---------------------------------
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to