aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Exporting a text file from EJB? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Exporting a text file from EJB?" Watch "Exporting a text file from EJB?" New topic
Author

Exporting a text file from EJB?

Radu Zaharia
Greenhorn

Joined: Aug 01, 2001
Posts: 18
Hi all,
I must export a text file (to a FTP address) from EJB. Since I cannot use the java.io package to first create a text file on the EJB server machine, what should I do?
Thanks,
Radu


Radu Zaharia
SCJP 1.4, SCBCD 1.3
Daniel Rhoades
Ranch Hand

Joined: Jun 30, 2004
Posts: 186
How about a POJO or servlet as a client to your EJB to create the text file and save it where you need it?


Drinking more tea is the key...
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Radu,

Since I cannot use the java.io package to first create a text file on the EJB server machine, what should I do?

Just one small correction: of course you can. Generally speaking you can do whatever your jvm and the java language will allow you to do. The problem is that this is not a recommended practice, mostly because the EJB container was designed to provide middleware services. From a transactional system point of view, having a business process operating a disc file is not acceptable. The EJB container is not a solution to every software problem, but only to some of them. Can you provide more details about the problem you�re wrestling with?
Regards.


I think, therefore I exist -- Rene Descartes
Radu Zaharia
Greenhorn

Joined: Aug 01, 2001
Posts: 18
Hi Valentin,

I have to export some data from a database into a text file, on a FTP server. I was first thinking of producing a text file in the EJB Container and then FTP it on the FTP server. But now I think I could read the data from the database and then append it directly in the file on the FTP server, without producing an intermediary text file. Would this be OK?

Thanks,
Radu
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Radu,

Just my thoughts. From a technical point of view, yes it might be ok. It might work and the data will be transferred to the destination via FTP. On the other hand, from a designing point of view it might not. The problem you�re solving looks mostly like a batch process than a business use case. Your task could be implemented without the need of any web server or ejb container. How about a simple java application? Ultimately you can write a shell script and schedule a cron job if your task needs to run periodically. Is there any particular reason enforcing your task to run within the EJB container?
Regards.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exporting a text file from EJB?