Results 1 to 3 of 3
Thread: to display table data from jdbc
- 11-23-2012, 03:09 PM #1
Member
- Join Date
- Nov 2012
- Posts
- 1
- Rep Power
- 0
to display table data from jdbc
here is code
import java.io.*;
import javax.swing.*;
package student;
import java.sql.*;
public class Main {
private static Object driverManager;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try{
load driverClass.forName("sun.jdbc.odbc.JdbcOdbcDriver" );
String url = "jdbc:odbc:studentDSN";
Connection con = driverManager.getConnection(url);
Statement st = con.createStatement();
String sql = "SELECT * FROM Student";
ResultSet rs = st.executeQuery(sql);
while(rs.next())
{
String name = rs.getString(“name”);String add = rs.getString(“address”);
String pNum = rs.getString(“phoneNum”);
System.out.println(name + “ ” + add + ” ” + pNum);
con.close();
}
catch(Exception sqlEx)
{
System.out.println(sqlEx);
}
}
private static void forName(String string) {
throw new UnsupportedOperationException("Not yet implemented");
}
// TODO code application logic here
}
}
pls tell how i can correct mistake
- 11-23-2012, 04:12 PM #2
Re: to display table data from jdbc
Moved from Suggestions & Feedback.
Please go through Guide For New Members and BB Code List - Java Programming Forum and edit your post accordingly.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 11-26-2012, 10:57 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Similar Threads
-
How to display data against row clicked on html table?
By reubenmk in forum Java ServletReplies: 3Last Post: 02-23-2012, 02:20 PM -
how to display data in a table format using jstl tag
By anand12356 in forum JavaServer Pages (JSP) and JSTLReplies: 3Last Post: 02-09-2011, 01:26 PM -
Table display
By gissah in forum NetBeansReplies: 1Last Post: 06-25-2009, 08:20 AM -
how to display the alerts in table
By geeta_ravikanti in forum JDBCReplies: 4Last Post: 04-04-2008, 06:45 AM -
Data formatting for the <display:table>
By yuchuang in forum Web FrameworksReplies: 3Last Post: 12-14-2007, 10:52 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks