Originally Posted by
Diyaka
i get the ff message when i try to connect to a database using the cods below.the message is aparch.jdbc.EmbbededDriver
the code is
if (evt.getSource().equals(Enter)) {
try {
Class.forName("org.apache.derby.jdbc.EmbbededDriver");
String url =" jdbc:derby://localhost:1527/Queens ";
String userid = "knust";
String pwd = "knust";
// Connection con= Connection;
Connection con= (Connection)
//Statement statement=connection.createStatement();
DriverManager.getConnection("url","knust","knust") ;
Statement stmt=con.createStatement();
// connection = DriverManager.getConnection(url, userid, pwd);
int ID = Integer.parseInt(Index.getText());
String Fnam = Fname.getText();
String Lnam = Lname.getText();
// String Department = Depart.getText();
// String Natio = Nation. getText();
// String Hal = Hall.getText();
// int Phon =Integer.parseInt (Phone.getText());
// int Leve =Integer.parseInt( Level.getText());
String sql="Insert into ROYALS values('"+(ID)+"','"+(Fnam)+"','"+(Lnam)+"')";
stmt.executeUpdate(sql);
Fname.setText("");
Index.setText("");
Lname.setText("");
JOptionPane.showMessageDialog(null, "values added to the database");
// statement = connection.prepareStatement("INSERT INTO APP.STUDENT" + "(Index No,Fname,Lname,Departmen,Nation,Hall,Phone,Level)" + "VALUES(IndexNo,Fnam,Lnam, Department, Natio, Hal,Phon,Leve )");
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
// this.setVisible(false);
// Gesa3 itermloader = new Gesa3();
// itermloader.setVisible(true);
}
can anyone help me solve the problem
Maybe check the spelling on the text in red.