This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes EJB and other Java EE Technologies and the fly likes Load .mdb file from EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Load .mdb file from EJB" Watch "Load .mdb file from EJB" New topic
Author

Load .mdb file from EJB

De La Hai
Greenhorn

Joined: Jun 04, 2008
Posts: 11
Hello !

I have a *.mdb file deployed within my ear. Which is located on Glassfish server like this:

MyApplication
- myDBFile.mdb
- myApplication-ejb_jar
- myApplicationWeb_war
- META-INF

The problem is that from EJBs perspective you can only use ClassLoader.getSystemResource(path) or equivalents of ClassLoader.methods.

However this leads me to deploy the .mdb database within a Jar. in my EJB project.

I would like to have it stored in EarContent of my project and access it from there. Is there any possibility to access files that are deployed along the ear from ejb context ?

I tried to get the context path of the ejb session , by using
but this doesn't really help much, as it only points to a path on the server and not on my project.

Can someone help me out, or point out whats wrong with the idea ?

Best regards,

LHD

PS: I know that it is against the restrictions of EJB, to access files in the filesystem. But it's more convenient to have the mdb file deployed within the ear for me.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Load .mdb file from EJB