tinoymalayil 0 Report post Posted July 20, 2009 How to get data from a database table to a java JTable...I am doin a project in Java.I need this..Please replyif anyone knows Share this post Link to post Share on other sites
sonesay 7 Report post Posted July 20, 2009 Search Jtable and Database in google and you should come up with plenty of links and examples. Try them out and let us know how it goes.Good luck. Share this post Link to post Share on other sites
tinoymalayil 0 Report post Posted August 1, 2009 use jav.lang.Vector class is used to hold the data from the database.but in some cases all of the data will be inserted in a single row.How to split the data into different rows? Share this post Link to post Share on other sites
mahesh2k 0 Report post Posted August 1, 2009 Some pointers for you, JDBC + JTable Google results * Hacking Swing: A JDBC Table Model * Mastering the JTable * Making SQL Queries with JDBC and Displaying Results with Swing As suggested earlier if you're working with small set of data then you can use java.lang.Vector or you can TableModel and then you can show it on JTable. Hope this will help. Share this post Link to post Share on other sites
iGuest 3 Report post Posted February 23, 2010 Query about jdbc connectivityTo Get Data In Jtable From DatabaseHi, I am really in a need of jdbc connectivity in net beans. Actually I hav created the login form module using Jframe and created , connected the database by Mysql, now I need by using which methodology I can retrieve data into my modle from database.. Pl pl reply soon if anybody know it!-reply by Vandhena.K Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 3, 2010 Query about jdbc connectivityTo Get Data In Jtable From DatabaseNot sure what your actual question is, or if you are lost and just want someone to give you complete code, probably that - here is an example from the web. If you want to be effective with JDBC and Swing, there is no substitute for learning it though. http://forums.xisto.com/no_longer_exists/;-reply by Barry Share this post Link to post Share on other sites
iGuest 3 Report post Posted February 18, 2011 I used netbeans IDE to designed the form and the jtable. I used drag and drop in netbeans private void getConnection(){//your connection code here}Connection con = getConnection(); try { ResultSet rows; Statement s = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); String select = "Select * from project"; rows = s.executeQuery(select); int i = 0; while (rows.next()){ String projName = rows.getString("projectName"); String status = rows.getString("status"); String date = rows.getString("date"); String timeAllocated = rows.getString("timeAllocated"); String timeSpent = rows.getString("timeSpent"); String billing = rows.getString("billing"); //calling data into jtable for display projectTable.setValueAt(projName, i, 0); projectTable.setValueAt(status, i, 1); projectTable.setValueAt(date, i, 2); projectTable.setValueAt(timeAllocated, i, 3); projectTable.setValueAt(timeSpent, i, 4); projectTable.setValueAt(billing, i, 5); i++; } } catch (SQLException e) { System.out.println(e.getMessage()); } } Share this post Link to post Share on other sites