I have created an embedded database using netbeans and added data to it. so now i want to query the database, the code runs smoothly but doesn't display data. Here is my code:
import java.sql.*;
public class EmbeddedDB
{
public static void main(String[] args)
{
Connection con = null;
Statement st = null;
ResultSet rs = null;
try
{
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
con = DriverManager.getConnection("jdbc:derby:CustDB;create=true", "app", "app");
System.out.println("connected");
st = con.createStatement();
System.out.println("statement created");
rs = st.executeQuery("select * from APP.TABLEX");
System.out.println("retrieving ...");
System.out.println(rs.getString(1));
}
catch(ClassNotFoundException | SQLException c)
{
}
}
}
so what could be the problem? the database was created in an embedded mode.