SQLException:Access denied for user ''@'local
Résolu
titchouzaune
Messages postés
219
Date d'inscription
Statut
Membre
Dernière intervention
-
arth Messages postés 9374 Date d'inscription Statut Contributeur Dernière intervention -
arth Messages postés 9374 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
je suis en train de faire un projet en java et je voudrais acceder à ma base de donné . le pb je recois sur Eclipse : SQLException:Access denied for user ''@'localhost' (using password: NO). Voila merci pour ceux qu'ils veulent bien m'aider.
ps: Normalement , le programme fonctionne
import java.sql.*;
public class Mysql {
public static void main(String[] args){
try{
Class.forName("com.mysql.jdbc.Driver");
try{
Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/poklo02");
Statement stmt = null;
ResultSet rs = null;
try{
stmt=conn.createStatement();
rs=stmt.executeQuery("SELECT nom FROM ");
if (rs!=null){
rs=stmt.getResultSet();
while(rs.next()){
System.out.println(rs.getString(1));
}
}
}
finally{
try{
if (rs!=null){
rs.close();
rs=null;
}
}
catch (SQLException sqlEx){}
}
}
catch (SQLException ex){
System.err.println("SQLException:"+ex.getMessage());
}
}
catch (Exception ex) {
System.err.println(ex.toString());
}
}
}
je suis en train de faire un projet en java et je voudrais acceder à ma base de donné . le pb je recois sur Eclipse : SQLException:Access denied for user ''@'localhost' (using password: NO). Voila merci pour ceux qu'ils veulent bien m'aider.
ps: Normalement , le programme fonctionne
import java.sql.*;
public class Mysql {
public static void main(String[] args){
try{
Class.forName("com.mysql.jdbc.Driver");
try{
Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/poklo02");
Statement stmt = null;
ResultSet rs = null;
try{
stmt=conn.createStatement();
rs=stmt.executeQuery("SELECT nom FROM ");
if (rs!=null){
rs=stmt.getResultSet();
while(rs.next()){
System.out.println(rs.getString(1));
}
}
}
finally{
try{
if (rs!=null){
rs.close();
rs=null;
}
}
catch (SQLException sqlEx){}
}
}
catch (SQLException ex){
System.err.println("SQLException:"+ex.getMessage());
}
}
catch (Exception ex) {
System.err.println(ex.toString());
}
}
}