Hi, I want to invoke an utility called "bcp" which is used to copy bulk data into Syabase Adaptive server.In my case I would need to upload rows to the tune of 2-3M. Now this bcp utility is a batch file(or shell script) sitting in the machine having the adaptive server. I need to invoke it remotely from a servlet which is running in a web server on some other machine.How can this be done in java?
Also as the process is asynchronous I would need some way of figuring out that the process has completed so that a confirmation mail can be send to the user who had invoked it.Any ideas on how this can be done?
To run anything on another machine you need some kind of remote protocol with a client on your end and a server on the other end. Choices run from dead simple to very complex - sockets, RMI, JMS, web services, EJBs, some utilitiy that's already on the server, etc. You might get lucky here ... could you call a stored procedure in the Sybase server that then runs the batch job? Once you get the protocol down we can think about how to make it asynchronous (if it's not already) and look for results.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Feb 17, 2005
Thanks! It looks like I can have the bcp batch file locally in the same machine as my webserver. So the first part of the problem gets solved.I can use Runtime.exec() to execute it I guess. However still thinking about the second part..should I start the batch process by spawning a new thread so that when the Runtime.exec() method retirns back we could send back an email or somthing to the user.I would probably put this whole thing in the run method.This would get started from a pop-up servlet(that Thread.start() would be called from a pop up servlet) so that the user might close the pop-up window and do something else(or go for a beer! ).But the thread would keep running in the background and whenever the process is over the user gets an email notification.
Does this sound good? Please comment..any other idea is also welcome.
Joined: Jan 29, 2003
A popup that says you will receive mail soon sounds like some registration and shopping sites I've been through, so your users will likely find it familiar or easy to follow.
My current project starts an applet in the browser. The applet opens a server socket so the server can push messages to the browser. That's a lot of work, but it is one way to notify the user that the asynchronous process has finished.