• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading and Writing Files In Ejb

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ALL
Can we read/write a file from/to a shared directory (can be on local
machine or remote machine) from an EJB

If yes How to do this, any supported link ,tutorials?

Thanks in advnace

Pankaj Narang
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not directly - the EJB spec. doesn't allow direct IO. There are good reasons for this: an EJB can't make any assumptions about what kind of file system its on, whether the application server has any access right to the file system, where the file resides in a clustered environment, or if there is even a file system at all (e.g. its deployed in something like JServer). Its also difficult to control file access security. And File IO isn't transactional, isn't best fit for enterprise systems.

You can however access the file system through a JCA adapter. This will sort the problems with file access, and you'll find JCA adapters for file system resources in some Application Servers already.

Another alternative is to use an RDBMS like a file system - and store/retrieve files as BLOBS. A lot of DBAs might be horrified by that suggestion, but it is a quick convenient way round this issue.
[ July 29, 2004: Message edited by: Paul Sturrock ]
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I hv got the same problem....I got to access the file system from EJB running under Websphere 5.0.2.

As mentioned in the above can anybody advise me how can I use JCA adaptor in Websphere 5.0.2 as I dont find any such adaptor in it to access file system.

Any suggestion or idea or alternative most welcome.

Thank you for your time.

-Ram
 
What are your superhero powers? Go ahead and try them on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic