This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC (ResultsModel)  RSS feed

Phil Berggren
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is my app erroring out only on ResultsModel statements? I found an old app I developed a version or 2 ago, and tried to compile under JDK 1.4, but it will not get past any ResultsModel statements. I am trying to use JDBC and a table view of results. I know that it worked before, but now it will not. Do I have to use a different statement now?
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've searched the sun website as well as the internet and can't find one reference to the "ResultsModel". Is this an object?? What was its purpose? The only equivalent that I can associate with this name is maybe ResultSet ?
I can tell you for sure that it will not work if it is not in the jdk documentation(it is not in the 1.3 documentation either)
Phil Berggren
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to give you a view of what I am doing here is the code:

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.table.*;
import java.sql.*;
public class CartonResearchDev extends JFrame{
//Define the application contents
Container contentPane;
JTextField txtDate1;
JTextField txtDate2;
JLabel lblDate1;
JLabel lblDate2;
JButton btn1;
public CartonResearchDev(String args[]){
super("Carton Research");
//Define connection variables
String user = "uk0dih3";
String password = "erin1030";
String url = "jdbc dbc kms feed";
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
//Create the contents of the app
contentPane = getContentPane();
contentPane.setLayout(new FlowLayout());
lblDate1 = new JLabel("Enter First Date:");
lblDate2= new JLabel("Enter Second Date:");
txtDate1 = new JTextField(10);
txtDate2 = new JTextField(10);
btn1 = new JButton("Click Me To Run Query");
btn1.addActionListener(new ActionListener(){
public void actionPerformed (ActionEvent ae){}

//Make connection to pkms history
connection = DriverManager.getConnection(url, user, password);
statement = connection.createStatement();

//Set layout for query results
ResultsModel model = new ResultsModel();
JTable table = new JTable(model);
JScrollPane resultsPane = new JScrollPane(table);
contentPane.add(resultsPane, BorderLayout.CENTER);

//Catch errors in the connection
}catch(ClassNotFoundException cnfe){
}catch(SQLException sqle){

public static void main(String args[]){

//Create the Application window
CartonResearchDev cr = new CartonResearchDev(args);
cr.setSize(300, 110);
Connection connection;
Statement statement;
ResultsModel model;
The results model was the way the results were held and displayed. This is a new app I am making that I copied and modified the code from an app that did work. I believe that it came from JDK 1.2
I am just trying to run a query and display the results in a table on my application. Can you tell me the way I should be doing this now? I can find only examples of text strngs returned form JDBC. I neeed the results in a scrollable table view for the users. The code posted is incomplete, so don't mind it too much.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!