Cant connect to mysql server with jdbc driver

Guys,



please help me with this code and I shall start breathing normally again.



My System confs are windows 98

Web server is Apache ver 1.3

JSP engine tomcat

mysql version 3.23.28 gamma



When i try to connect to my mySql server i get the following errors:



SQLException: invalid authorization specification:access denied for user:'sushil@localhost' (using password:NO)

SQLState: 28000

VendorError: 1045





My JSP:







<%@page import="java.sql.*" %>

<%@page import="java.io.*" %>



<%<br>


String login = request.getParameter("hlogin");

String password = request.getParameter("hpassword");

String fname = request.getParameter("hfname");

String lname = request.getParameter("hlname");

String email = request.getParameter("hemail");



String url = "jdbc:mysql://localhost:3306/dbname?user=myusername=mypasswd";



String query = "insert into members values('";

query += login + "','" + password + "','";

query += fname + "','" + lname + "','" + email + "')";





try

{



// The newInstance() call is a work around for some

// broken Java implementations



Class.forName("org.gjt.mm.mysql.Driver").newInstance();



}

catch (Exception E)

{

System.err.println("Unable to load driver.");

E.printStackTrace();

}





try

{



Connection con = DriverManager.getConnection(url);

Statement stmt = con.createStatement();





stmt.executeUpdate(query);



con.close();

stmt.close();



}

catch (SQLException E)

{

System.out.println("SQLException: " + E.getMessage());

System.out.println("SQLState: " + E.getSQLState());

System.out.println("VendorError: " + E.getErrorCode());

}







%>



*******************------------------*****************

Thanks a lot in advance



Sushil Dudhalkar




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories