File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Distributed Java and the fly likes RMI client-side SQL and File I/O Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI client-side SQL and File I/O" Watch "RMI client-side SQL and File I/O" New topic
Author

RMI client-side SQL and File I/O

Brian Healey
Greenhorn

Joined: Jan 19, 2004
Posts: 5
I have a newbie question.
Can RMI be used to execute SQL statements on a Client's MS access db?
Also, can RMI be used to do File I/O on that client.
Bea does a great job introducing this topic, but I could not find an answer to either of those questions, directly.
If at all possible, without coding, could someone explain what is required?
For example if the client machine needs JVM 1.4.1 installed, with correct parameters to allow applets certain rights, or what have you. While on the server side, you would need EJB that talks to the client and/or jsp pages.
If someone could briefly explain what componenets are used where, that would help me out tremendously.
Thank you
bhealy1@verizon.net
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
Not sure if I know the answer you need, but are you trying to use RMI with an application or from within a webbrowser as an applet? Can you refine your requirements? are you trying to reach out from a server and change the client DB at will or are you simply trying to respond to some message from the client and then the client could change the DB based on your response?
The RMI "server" is really just a response based system you have to send it a message(call one of its methods) to get a response(whatever its return value is). AFAIK the server cannot reach out and contact the client on its own.
This would apply to both DB stuff and file system stuff. If your client java app/applet has access to change the DB/filesystem then in response to a returned valueset from the server, it could make changes to either of those.
Hope this has helped at least a bit,
Chris
Brian Healey
Greenhorn

Joined: Jan 19, 2004
Posts: 5
Hi,
First, thanks for getting back to me. Here's an attempt to better explain our situation.

Each day, new customers will go on to our web site. They will sign up for our service at any one of our 500 locations. Each night, we'll create a text file on an ftp site with that basic customer data - name address phone, etc, and label it with the location number. The next morning, each of the 500 clients will log on to their local windows machines, connect to the internet (some are dial-up) and browse to a web site. The web site will have a url that they can download that day's customers. Then, (somehow) there will be code that can executed so that it does the following:
opens the file
for each line - create a recordset object and lookup in the access database to see if they are already a customer (this is actually an issue, and we don't want to duplicate customers)
if they don't exist, add them
otherwise, update their information
next line
The database is a part of a vb app, and as of now we can not change this part of the situation.
We have tried vb, but have run into run-time, dll, and compatibility issues. These issues may not be anything extrodinary, but the time to play phone tag and debug would make the project very difficult. So we'd like to pursue the java idea. Moreover, more and more we are looking to become a java shop rather than .net.
Thanks again for your help.
Brian
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
Originally posted by Brian Healey:

Each day, new customers will go on to our web site. They will sign up for our service at any one of our 500 locations. Each night, we'll create a text file on an ftp site with that basic customer data - name address phone, etc, and label it with the location number.

OK, that makes sense. You could also do it with XML instead of a plain text file and it *might* be easier(ok probably, but i don't know XML that well).
The next morning, each of the 500 clients will log on to their local windows machines, connect to the internet (some are dial-up) and browse to a web site. The web site will have a url that they can download that day's customers.

Hmm why not just have the java code do it all? Use it to collect the file and then update the db.
Then, (somehow) there will be code that can executed so that it does the following:
opens the file
for each line - create a recordset object and lookup in the access database to see if they are already a customer (this is actually an issue, and we don't want to duplicate customers)
if they don't exist, add them
otherwise, update their information
next line

Ok, thats all doable(assuming you can manipulate the DB from your java app) I don't work with vb or any dbs that are usually associated with it(I use firstsql), so I don't know about that part. The customer duplication issue you could just crosscheck their info to see if it is the same person. There are ways to check similarity between entries unless a person is trying to get into your DB twice(for coupon mailings/other perks).

The database is a part of a vb app, and as of now we can not change this part of the situation.
We have tried vb, but have run into run-time, dll, and compatibility issues. These issues may not be anything extrodinary, but the time to play phone tag and debug would make the project very difficult.

Well, there would be some debugging to do with anything like this. It should be minimal tho, since there isn't a lot of variation in the activity you want. Once it works, it should always work.
So we'd like to pursue the java idea. Moreover, more and more we are looking to become a java shop rather than .net.

an admirable goal. It should work fine. Last question to think about tho, whats your time frame for implementation? Just "asap" or is there a drop dead date you have to consider?
Chris
Oh by the way, your email address didn't work for me. I tried to send you something yesterday.
[ January 21, 2004: Message edited by: Chris Shepherd ]
Brian Healey
Greenhorn

Joined: Jan 19, 2004
Posts: 5
sorry about the email
it should be bhealey1@verizon.net or thry bhealey@brighthorizons.com
Could I ask for a bit of clarification?
When you say above 'have java do it all'? I guess that's what I'm trying to find out - if it's possible. Meaning, what components would go where? I am guessing that the JVM 1.4.1 free download from sun would have to be setup on each of the clients. Then where eactly we'd code things is the question. If we set everything up on the server, and 'push it down' to the client, would that be via an RMI connection, a servlet to applet connection, both, etc. What generally works - writing code on the server and creating a connection to push the code down, or writing code for the local client, who would initiate the process. I'm just not sure which components will work.
Thanks again for all of your help.
-Brian
[ January 21, 2004: Message edited by: Brian Healey ]
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
oh its possible.
I am guessing that the JVM 1.4.1 free download from sun would have to be setup on each of the clients.

Not really necessary if you think in terms of distributing this as an app. And most likely not desired either. Makign each of your clients download the large JRE and getting them to install it in the right place sounds like a nightmare. You're better off just doing it all within your own installation so you know what goes in where, and what java version they are using.
If we set everything up on the server, and 'push it down' to the client, would that be via an RMI connection, a servlet to applet connection, both, etc. What generally works - writing code on the server and creating a connection to push the code down, or writing code for the local client, who would initiate the process. I'm just not sure which components will work.

RMI will work fine for you IF you are ok with the clients updating themselves by running your update program on their machine every day. You can't push data down from the server in any reasonable way using RMI. I can't speak to servlets or applets, since I haven't worked with those. Perhaps someone else can.
As for RMI, you would write code for the client software to initiate the transfer and also make the changes to the client's machine. You'll have to answer some of the other questions I posed in my previous post before you'll know if java can "do it all" in your situation. The most glaring issues are the Database control and the limitations of your time and funding.
Chris
Brian Healey
Greenhorn

Joined: Jan 19, 2004
Posts: 5
Hi,
Sorry I haven't checked in until now. We were looking for 'can it happen answers' before we went a head and made an estimate on deadlines and budget considerations.
Thanks for all of your help on this
If possible I'd like to keep this post open for a while.
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
hmm it's been a week. Doesn't look like you are going to get much more imput. Maybe if I just ask how its going with the project this won't look too much like a bump. nooo nothing like a bump. well ok maybe a little one
Chris
Romulu Romu
Greenhorn

Joined: Jan 22, 2004
Posts: 8
If you use some client java-code(rmi-client?) to do the database updating in client, is it enough to put classes used in that apllication to client machine? and how to do an executable from those? making jar-file with
main-class header pointing to the start-up class(static main String(..)).
I remember reading that making jar-files executable requires putting them in some place in jre-directory tree? Or is there some other possibility?
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
Please don't hi-jack threads. Keep this in its own thread you already posted
Romulus Romu
Greenhorn

Joined: Jan 21, 2004
Posts: 2
Sorry, I didn't meant to hi-jack. My post was meant here originally. The new thread I created was an accident.
 
Consider Paul's rocket mass heater.
 
subject: RMI client-side SQL and File I/O
 
Similar Threads
No need for a locking manager?
Multiple lock requests on the same record number
I am close to submit - please help
Locks without Client IDs?
RMI