sql - JDBC table/view does not exists -
i tried create simple project show me in database.
so created new database in netbeans's services tab, created table , fill them. went glassfish
admin panel create jdbc connection pool
, resource
.
pool :
pool name : bddpool resource type : javax.sql.connectionpooldatasource classname : org.apache.derby.jdbc.clientdatasource40
resource :
jndi name : jdbc/bdd connection pool : bddpool
back on netbeans, created simple dao file retrieve data query :
package model.ejb; import java.sql.connection; import java.sql.resultset; import javax.annotation.resource; import javax.ejb.stateless; import javax.sql.datasource; /** * * @author choup */ @stateless public class bdddao { @resource(name = "jdbc/bdd") private datasource ds; public void retrievedata(){ try{ connection conn = ds.getconnection(); resultset rs = conn.createstatement().executequery("select * student"); while( rs.next()){ system.out.println(rs.getstring("name")); system.out.println(rs.getstring("address")); } conn.close(); } catch(exception e){ system.err.println(e.getmessage()); } } }
i run , here's got :
infos: projet_fitts deployed in 206 milliseconds. grave: la table/vue 'student' n'existe pas.
=> table/view student not exist.
so search while , there might jdbc url put somewhere don't have files, glassfish-web.xml
.
btw: can ping database on admin panel. if have suggestions or need more info let me know.
Comments
Post a Comment