Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > database access, java bridge, etc.

database access, java bridge, etc.
Thread Tools
Fresh-Faced Recruit
Join Date: Feb 2001
Status: Offline
Reply With Quote
Aug 1, 2001, 09:07 AM
 
I'd like to write a front-end for a PostgreSQL database. I've been toying with different languages/environments (Pure Java, Cocoa-Java, Realbasic, etc.) but I'd like to do it in Objective-C. Which leads to question 1:

Is there any way to access the database with the Objective-C libraries?

Because I couldn't find a way, I've been experimenting with JDBC. I've been able to get a Cocoa-Java app to work (at this point just testing that I can connect to the db and display a response), but I've had a lot of difficulty doing it in Objective-C with the java bridge. Here's what I've done:

I've written a java class that acts as an intermediary between the Objective-C code and the database (via JDBC). My problem now is getting this class across the bridge. I've tried using NSClassFromString, but I keep getting an error saying that my class is undeclared. So: How do I get my own classes across the bridge---where do I put them, how do I include them, etc.? Are there any tutorials around?

Another tutorial question: Are there any tutorials around for manipulating data sources and TableViews?

Thanks,

-Joshua
     
Fresh-Faced Recruit
Join Date: Feb 2001
Status: Offline
Reply With Quote
Aug 1, 2001, 01:33 PM
 
I was able to get this working. After a lot of fooling around and a lot of internet searching, here's what I've discovered:

Apple's documentation on invoking Java from within Objective-C is missing some vital information. Here's what they have:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
MyJavaClass = NSClassFromString(<font color = orange>@"java.util.AJavaClass"</font>);MyJavaObj = [[MyJavaClass alloc] init];
</font>[/code]

What they've neglected to include is that prior to this you must declare:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
Class MyJavaClass;
<font color = purple>id</font> MyJavaObj;
</font>[/code]

This is obvious when you think about it, but it took me an embarrassingly long time to figure it out. (I hope this helpful for future searchers.)

I'd still like recommendations on any NSDataSource -&gt; NSTableView tutorials, especially involving the use of Java's ResultSet.

-Joshua
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:21 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2