i think you should check the privileges : grant all on work.* to user@host identified by "pass" check again the host, because "host" in servlet seem does not like in another application. i'm working on my own computer, MySQL query from PHP is my domain, but from servlet is localhost :) u should test:
try { yr sql query } catch (Exception e) { // not SQLException out.println(e.getMessage()); } to see what message from Exception. ----- Original Message ----- From: "Luigi Fonti" <[EMAIL PROTECTED]> To: "Nguyen Trong Phuc" <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 1:05 AM Subject: Re: Accessing mysql database from a servlet > It is exactly what I do. But in a normal java application it works, > while in a servlet it doesn't. > Luigi Fonti > > Nguyen Trong Phuc wrote: > > > this is the way to connect to MySQL from JDBC: > > > > Class.forName(driverName).newInstance(); > > Connection con = DriverManager.getConnection(dbURL, userName, passWord); > > Statement stmt = con.createStatement(); > > > > driverName = "org.gjt.mm.mysql.Driver" > > dbURL = "jdbc:mysql://host:3306/db" > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php