0

this is my 9th hour today and i have decided to finally reach out and seek a little bit of help because i am really struggling with this. I have been googling for hours and i can't seem to find a suitable solution for what i am looking for.

The background, I am using Java DB to store my info and then pulling it up using a query and then trying to get that into an existing JTable, but i am not doing very well at all. Im sure there will be a very simple answer to this, so i seek help from anyone who can help! Any advice is much appreciated!

This is how far I have gotten so far, i have already created the table with the correct columns and it is inside the program, not a pop up table, i really dont have a clue and i thank you in advance!

String URL = "jdbc:derby://localhost:1527/Teams";
    String Usr = "admin";
    String Pwd = "password";

    try {
        Connection con = DriverManager.getConnection(URL,Usr,Pwd);
        Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
        String SQL = "SELECT * FROM RESULTS";
        ResultSet rs = stmt.executeQuery( SQL );

        while(rs.next()){

            int GAMEID = rs.getInt("GAMEID");
            String HOEMTEAM = rs.getString("HOMETEAM");
            String SCORE = rs.getString("SCORE");
            String AWAYTEAM = rs.getString("AWAYTEAM");



        }
  • Really is worth reading about resource management so you don't leak them. See try finally and try-with-resources. What exactly isn't working? Do you have any code that processes the data you have loaded? – GoldenJam Jan 10 '15 at 17:50
  • I have tried to process it before but it didnt work so i deleted it. I was looking to try and use something like "addrow" but that doesnt work for this scenario – Josh Jeffries Jan 10 '15 at 17:55

0 Answers0