 |
 |
Q: java.sql.ResultSet && NSTableView.DataSource?
|
 |
|
 |
|
Junior Member
Join Date: Sep 2000
Location: Washington State
Status:
Offline
|
|
I am trying to build a Cocoa/Java app that takes results of a SQL Query and inserts them into an NSTableView.
As I understand it, I need to specify an object that implements the NSTableView.DataSource interface. Fine. I would like to extend the standard ResultSet to do this, however I cannot figure out how to accomplish this. ResultSet seems to be an interface as well. If it is instantiated, it must be implemented in some class, right?
Anyhow, any help would be appreciated. This is my first real Cocoa/Java project of any complexity. If anyone can point me to code samples or anything, that would be great.
Mr. Sharumpe
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Nov 2000
Status:
Offline
|
|
I'm actually working on the same thing in Cocoa using the java bridge to access the database via some java utility classes. I was wondering if yo uwould be open to a collaborative process.
feel free to email me directly at mxcantor@sas.upenn.edu
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2001
Location: Dixon, Ca
Status:
Offline
|
|
sharumpe,
A JDBC driver returns the driver vendors implementation of the ResultSet interface. A simple example would be when an application calls Statement.executeQuery("SELECT * FROM SOMETABLE"). The call to executeQuery is guaranteed to return either a ResultSet or to throw an exception. Using ResultSet.next() and the various getXXXX() methods you can iterate through the rows and columns and insert the data into your NSTableView. It's not exactly clear to me what your intent is, but I don't think you want to extend ResultSet when the JDBC driver is already returning you an object which has fully implemented the ResultSet interface.
I recently finished a project implementing a JDBC driver for accessing IBM DB2 databases. If you want to email me with more specific questions I'd be happy to try and answer them.
Bob
|
|
So they cloned a sheep - who could tell the difference anyway? - Robin Williams
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Sep 2000
Location: Washington State
Status:
Offline
|
|
Originally posted by gandalf:
It's not exactly clear to me what your intent is, but I don't think you want to extend ResultSet when the JDBC driver is already returning you an object which has fully implemented the ResultSet interface.
I was hoping to be able to extend ResultSet to implement the NSTableView.DataSource interface. In other words, the ResultSet needs to respond to messages that tell the NSTableView how to display its data.
I have created an object that does the job, but it means duplicating data, and I don't like that. Also, a future possibility for the project is to allow the user to change the data. If I remember correctly, JDBC 2 has methods that allow ResultSet data to be updated by simply changing the data in the ResultSet and issuing an update message.
Anyhow, the whole thing would be cleaner if the data returned from the SQL query only existed in one spot.
I think I will explore extending the driver-specific ResultSet (OracleResultSet, in this case) to do what I need.
Thanks!
Mr. Sharumpe
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |