• Post Reply Bookmark Topic Watch Topic
  • New Topic

display table from database

 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I have written a library application using swings. Now i wnat to do the same with JSP, i have successfully connected to the database
now i want the table to be displayed. How can i achieve this.
my code for connectivity:

<%@ page import = "java.sql.*" %>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbcdbc:jsp","jsp","bismillah");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM temp");
rs.next();
int num = rs.getInt(1);
if(num>=2)
{
out.println("success");
}
else
out.println("failed");
}
catch(Exception e)
{
out.println(e);
}
%>

Thanks and Regards
[ October 06, 2008: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65520
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two things:

1) Please use real words when posting to the forums. Abbreviations such as "REG" in place of whatever it's supposed to mean (I have no idea) only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

2) Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the .

I have modified the topic title to something meaningful.
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your suggestion.
I have got the solution :p
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!