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 firtst foray into JDBC/ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "firtst foray into JDBC/" Watch "firtst foray into JDBC/" New topic

firtst foray into JDBC/

Gary Down
Ranch Hand

Joined: Apr 09, 2004
Posts: 46
Hi all,
this is my first foray into the realms of JDBC/ODBC....

The aim of the code (below) is to fetch data from my database (later to be on my website) and return it to the client applcation where it will be updated. No changes are to be made to the database until all user changes have been made (maybe many/none).
the code (one of many) on the client side to invoke this is

This works fine.

The Question...
How would I make the same
"private static Set usersArray = new TreeSet();"
available to a 2nd user (via a second instance of the application) without accessing the database again.

Thanks in advance,

arnel nicolas
Ranch Hand

Joined: Dec 16, 2003
Posts: 149
i just don't get what you are trying to do. From my understanding, you want the usersArray object to be available for the next user. If you are using JSP or servlet for your application, you may want to put the usersArray object as an attribute in the Context of your application. In that way your object is visible for the rest of the application.
Gary Down
Ranch Hand

Joined: Apr 09, 2004
Posts: 46
guess I'm not too clear..

This was written as a single user application running on a single desktop PC.
Now we would like to expand it to have the data held in a single central database (most likely on a website). The aim here is to allow several users access to the data. All the users (young students at that) will need to have access to the same starting information. Each student will update their respective copies of the data and then (when OKd by the teacher) the updates will be applied to the database.
The problem is that some students may finish before others have even started, causing the later students to begin with a different set of data.

Hope that is a bit clearer.

Gary Down
Ranch Hand

Joined: Apr 09, 2004
Posts: 46
Am I heading in the right direction....

I have been reading up on RMI and get the impression that I could create a server program, which when started could populate it's "Sets"

e.g. in this case "private static Set usersArray = new TreeSet();".

Then as each client transaction called to get the "Sets" it could just return them as required (given that the necessary functions have been implemented via the interface).

If so, and given the "main" coding below, what do I need to do in the "client" side and (if anything) external to the JAVA classes (e.g. policy file??)

At the moment I get
WBRemote exception: access denied ( G resolve)
at the Naming.rebind statement

I agree. Here's the link:
subject: firtst foray into JDBC/
jQuery in Action, 3rd edition