Table not found in statement

Class.forName("org.hsqldb.jdbcDriver");
    conn = DriverManager.getConnection("jdbc:hsqldb:file:Pokemondaten","sa","");
    getData = conn.createStatement();
    ResultSet rs = getData.executeQuery
    ("SELECT HP FROM PKMN WHERE ID = " + basicnumber); 
    int hpp = rs.getInt(1);
    System.out.println(hpp);
all I get is
java.sql.SQLException: Table not found in statement [SELECT HP FROM PKMN]
    at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
    at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
    at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
    at pokeWpRechner.Main.main(Main.java:46)
My Databased is called Pokemondatenand my table is called PKMN, also my table is inherited in the programm.
So what did i do wrong? i dont get it.
Hi Ekonion, 
You are facing above problem.You may tree this code for fetching value from database .

public class DBconnectionWithFetchData {
public static Connection getconnection()
{
String Driver ="org.hsqldb.jdbcDriver";
String url ="jdbc:hsqldb:Pokemondaten";
Connection con =null;

try
{
Class.forName(Driver);
con=DriverManager.getConnection(url,"sa","");
    Satement stmt=con.createStatement();
    String sql="SELECT HP FROM PKMP WHERE id='"+basicnumber+"'; }
catch(ClassNotFoundException ex)
{
ex.printStackTrace();
}
catch(SQLException ex)
{
ex.printStackTrace();
}
return con;
}
}

Comments

Popular posts from this blog

Export data from mysql db to csv file using java

Secure Database Connectivity in node.js with mysql