This question already has an answer here:
- Derby Schema Error 2 answers
i am creating desktop application which uses derby embedded database, although when i use derby as a client database then it works fine, but i want to embed this database with my desktop application then it throws error below is the code for help, check it out
public class TaxInvoice extends javax.swing.JFrame {
//String connectionurl = "jdbc:derby://localhost:1527/embdIDA1db";
String connectionurl = "jdbc:derby:embdIDA1db;create=true;user=root;password=root";
Connection conn = null;
ResultSet rs;
String po_no = null;
/**
* Creates new form TaxInvoice
*/
public TaxInvoice() {
initComponents();
String dt = sdf.format(cal.getTime());
cur_date.setText(dt);
try{
Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
conn = DriverManager.getConnection(connectionurl,"root","root");
String sql="Select * from IMPORTED_CSV";
Statement s = conn.createStatement();
s.executeQuery(sql);
rs = s.getResultSet();
while(rs.next()){
po_no = rs.getString("PO_NO");
jTextField1.setText(po_no);
}
rs.close();
s.close();
}
catch(Exception e){
System.out.println("Error is"+e);
}
}
and the error is
Error isjava.sql.SQLSyntaxErrorException: Schema 'ROOT' does not exist