File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JDBC (ResultsModel) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC (ResultsModel)" Watch "JDBC (ResultsModel)" New topic

JDBC (ResultsModel)

Phil Berggren

Joined: Jul 13, 2001
Posts: 5
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

Joined: Jul 09, 2001
Posts: 1879

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

Joined: Jul 13, 2001
Posts: 5
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.
I agree. Here's the link:
subject: JDBC (ResultsModel)
It's not a secret anymore!