• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

unable to retrieve data from the db  RSS feed

Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

im new to jdbc and tried my first app using netbeans 5.5. my db is apache derby. i have correctly set up the driver and populated some tables. but when i write the neccessary code in my jsp to retrieve information through the DB no data is being displyed. following is my jsp code
<% InitialContext context = new InitialContext();
DataSource dataSource=(DataSource)context.lookup("java:comp/env/jdbc/DataSourceExample");
Connection conn = null;
Statement stmt = null;
ResultSet rset = null;
rset=stmt.excuteQuery("select * from TRAVEL.CARRENTAL");
<%= rset.getString("TRIPID")) %>

<% }
catch(SQLException e){}%>
<% finally{
if(rset !=null){rset.close();}
if(stmt !=null){stmt.close();}
if(conn !=null){conn.close();}
if(context !=null){context.close();}


can some one please point out to me as to what im doing wrong?

thank you in advance
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't seem to be moving though your ResultSet. I'd expect this sort of logic when using a ResultSet:
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!