File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes db connection problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "db connection problem" Watch "db connection problem" New topic

db connection problem

Rafael Fagundes
Ranch Hand

Joined: Sep 23, 2004
Posts: 52
Hello all.
In a jsp application, I�m trying to conect to the application�s db (MySQL) by:
// jsp file
YYY.Atividade atv;
atv = new YYY.Atividade();
// bean
public void criaConexaoBD()throws ClassNotFoundException, IllegalAccessException,InstantiationException, SQLException
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://";
this.conexaoBanco = DriverManager.getConnection(url, "root", "");
this.v_statement = this.conexaoBanco.createStatement();

I�m getting this server (Tomcat v. 5.0) message:

ERRO :java.sql.SQLException: Invalid authorization specification, message from server: "Access denied for user: 'root'@'' (Using password: NO)" .

Even using a password or changing the user i�m getting the same trouble...I know that if i use
url= "jdbc:mysql://localhost/mdb1";
the connection work�s...

Does somebody know�s what�s wrong?
Thank�s for your attention,
[ October 11, 2004: Message edited by: Rafael Castro Fagundes ]

Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
i think it is something about MYSQL Driver. see the specification of MYSQL Driver. may be it differs when your DB is remote.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63857

Since this is much more about JDBC than the JSP enclosing it, I'm moving this along to the JDBC forum.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: db connection problem
It's not a secret anymore!