4 Replies - 660 Views - Last Post: 18 December 2013 - 07:50 PM Rate Topic: -----

#1 jesders88  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 46
  • Joined: 25-October 12

Java JTable Tutorial with SQL Server 2012

Posted 18 December 2013 - 03:55 PM

Can someone point me in the direction of a good video tutorial of how to use a JTable. I would like to learn everything about what the table is to how to connect it to a sql server database. It doesnt have to be a video but it would be nice and a full walkthrough of a program would be nice. Anybody know of one or two?
Is This A Good Question/Topic? 0
  • +

Replies To: Java JTable Tutorial with SQL Server 2012

#2 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

Re: Java JTable Tutorial with SQL Server 2012

Posted 18 December 2013 - 04:17 PM

The big thing you want is content-code separation. Are you familiar with MVC? Get out of the mindset of "a JTable connecting to the database." The JTable is just a fancy display for the data. The TableModel is what stores the data. You will want a custom TableModel to organize your data, then you pass an instance of it to the JTable. The JTable has more responsibility for getting new data, best by interacting with a database connectivity component. Definitely look into MVC.

The Tutoracles are a good place to start for learning more about JTables.
Was This Post Helpful? 0
  • +
  • -

#3 g00se  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2735
  • View blog
  • Posts: 11,525
  • Joined: 20-September 08

Re: Java JTable Tutorial with SQL Server 2012

Posted 18 December 2013 - 04:20 PM

Quote

how to connect it to a sql server database.
Depends what you mean by 'connect'. As it happens, JTable is not a class for connecting to anything. It's a visual component that displays, in a tabular format, data held in a souped-up Collection (sometimes called a 'container class' in other languages).

I'm just telling you that so you don't think you're going to be looking at something like an MS Access gui

This post has been edited by g00se: 18 December 2013 - 04:21 PM
Reason for edit:: Clarification

Was This Post Helpful? 1
  • +
  • -

#4 jesders88  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 46
  • Joined: 25-October 12

Re: Java JTable Tutorial with SQL Server 2012

Posted 18 December 2013 - 07:39 PM

View Postmacosxnerd101, on 18 December 2013 - 04:17 PM, said:

The big thing you want is content-code separation. Are you familiar with MVC? Get out of the mindset of "a JTable connecting to the database." The JTable is just a fancy display for the data. The TableModel is what stores the data. You will want a custom TableModel to organize your data, then you pass an instance of it to the JTable. The JTable has more responsibility for getting new data, best by interacting with a database connectivity component. Definitely look into MVC.

The Tutoracles are a good place to start for learning more about JTables.



Yes, that is all my instructor allows. I get how to use it, the thing thats difficult for me to grasp is what things do behind the scenes like connecting to the database from java and so on and so forth. I see you attached a tutorial and thanks. Is there a big difference from connecting from java to sql server to connecting java to mysql?
Was This Post Helpful? 0
  • +
  • -

#5 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

Re: Java JTable Tutorial with SQL Server 2012

Posted 18 December 2013 - 07:50 PM

It would be more the connection string. Beyond that, the tools work the same. The SQL syntax might be a bit different as well, but I doubt that will pose a major concern for you.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1