Estou com um projeto para universidade, porém com um erro! quando eu tento confirmar uma reserva com o btnConfirmaReserva configurado no formulário me da o seguinte erro na conexão com o banco de dados:
“errororg.apache.derby.jdbc.ClientDriver”
alguem saberia informar porque?
ai vai o código inserido no Jframe:
[code]private void btnConfirmaReservaActionPerformed(java.awt.event.ActionEvent evt) {
Connection con;
PreparedStatement cmd;
this.dispose();
Reserva f = new Reserva();
try {
String sql="INSERT INTO APP.LISTARESERVA "
+ "(nome,numreserva,rg,telefone) "
+ “VALUES (?,?,?,?,?)”;
f.setNome(txtNome.getText());
f.setTel(Integer.parseInt(txtTel.getText()));
f.setRG(Integer.parseInt(txtRG.getText()));
f.setNumReserva(Integer.parseInt(txtReserva.getText()));
con = Conexao.Conectar();
cmd = con.prepareStatement(sql);
cmd.setString(1, f.getNome());
cmd.setInt(2, f.getNumReserva());
cmd.setInt(3, f.getRG());
cmd.setInt(4, f.getTel());
cmd.executeUpdate();
con.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(this,"error: " + e.getMessage());
}
}[/code]
sendo que criei uma classe para conexão ai vai ela :
[code]package projeto.unaerp.conexao;
import java.sql.*;
public class Conexao {
private static final String DRIVER = “org.apache.derby.jdbc.ClientDriver”;
private static final String URL = “jdbc:derby://localhost:1527/sample”;
private static final String USUARIO = “app”;
private static final String SENHA = “app”;
public static Connection Conectar(){
try {
Class.forName(DRIVER);
return DriverManager.getConnection(URL,USUARIO,SENHA);
} catch (Exception e) {
System.out.println("error" + e.getMessage());
return null ;
}
}
}
[/code]