SQLException
yasmin
-
yasmin -
yasmin -
Bonjour,
mon application es sous netbeans, je doit me connecter a une base de donne mysql sous easyphp,
lorsque je fait run il signal de l'error suivant:
SQLException: Something is wrong in your syntax près de 'SESSION VARIABLES' à la ligne 1
SQLState: 42000
VendorError: 1064
mon code en netbeans est:
private void connexionActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String login_=Login.getText();
AccessibleContext motdepasse_=Motdepasse.getAccessibleContext();
AfficheUsers use = new AfficheUsers();
use.main();
}
/**
* @param args the command line arguments
*/
public class AfficheUsers
{
public void main ()
{
Connection conn;
Statement stmt;
ResultSet rs;
String pilote = "org.gjt.mm.mysql.Driver";
String url = new String("jdbc:mysql://localhost/projet");
try
{
Class.forName(pilote);
conn = DriverManager.getConnection(url,"root","");
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT * FROM profil WHERE profil.LOGIN='"+ login + " and profil.MOTDEPASSE='" + motdepasse );
while (rs.next())
{
Recherche cher = new Recherche();
cher.setVisible(true);
}
rs.close();
stmt.close();
conn.close();
}
catch ( SQLException E)
{
System.out.println("SQLException: " + E.getMessage());
System.out.println("SQLState: " + E.getSQLState());
System.out.println("VendorError: " + E.getErrorCode());
}
catch ( ClassNotFoundException E)
{
E.printStackTrace();
}
}
}
mon application es sous netbeans, je doit me connecter a une base de donne mysql sous easyphp,
lorsque je fait run il signal de l'error suivant:
SQLException: Something is wrong in your syntax près de 'SESSION VARIABLES' à la ligne 1
SQLState: 42000
VendorError: 1064
mon code en netbeans est:
private void connexionActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String login_=Login.getText();
AccessibleContext motdepasse_=Motdepasse.getAccessibleContext();
AfficheUsers use = new AfficheUsers();
use.main();
}
/**
* @param args the command line arguments
*/
public class AfficheUsers
{
public void main ()
{
Connection conn;
Statement stmt;
ResultSet rs;
String pilote = "org.gjt.mm.mysql.Driver";
String url = new String("jdbc:mysql://localhost/projet");
try
{
Class.forName(pilote);
conn = DriverManager.getConnection(url,"root","");
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT * FROM profil WHERE profil.LOGIN='"+ login + " and profil.MOTDEPASSE='" + motdepasse );
while (rs.next())
{
Recherche cher = new Recherche();
cher.setVisible(true);
}
rs.close();
stmt.close();
conn.close();
}
catch ( SQLException E)
{
System.out.println("SQLException: " + E.getMessage());
System.out.println("SQLState: " + E.getSQLState());
System.out.println("VendorError: " + E.getErrorCode());
}
catch ( ClassNotFoundException E)
{
E.printStackTrace();
}
}
}