aspose file tools*
The moose likes JDBC 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
Bookmark "JDBC (ResultsModel)" Watch "JDBC (ResultsModel)" New topic
Author

JDBC (ResultsModel)

Phil Berggren
Greenhorn

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)
Jamie.
Phil Berggren
Greenhorn

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
this.setResizable(false);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
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);
contentPane.add(lblDate1);
contentPane.add(txtDate1);
contentPane.add(lblDate2);
contentPane.add(txtDate2);
btn1 = new JButton("Click Me To Run Query");
//btn1.setMnemonic(KeyEvent.VK_C);
btn1.addActionListener(new ActionListener(){
public void actionPerformed (ActionEvent ae){}
});
contentPane.add(btn1);
try{

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

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

//Catch errors in the connection
}catch(ClassNotFoundException cnfe){
System.err.println(cnfe);
}catch(SQLException sqle){
System.err.println(sqle);
}
pack();
setVisible(true);

}
public static void main(String args[]){

//Create the Application window
CartonResearchDev cr = new CartonResearchDev(args);
cr.setSize(300, 110);
cr.setVisible(true);
}
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.
Thanks
berg
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC (ResultsModel)