Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB - file I/O  RSS feed

 
Johannes de Jong
tumbleweed
Bartender
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I still don't know which way to go.
We have written a system that converts IBM MQ messages in XML format to IBM MQ messages in Cobol copybook format. We use DOM & XPATH to do the transformation. The format of the Cobol copybook message are contained in a XML "specification" file. At the moment the system totally ignores the NO file I/O rule that is part of the EJB spec.
I'm now busy to look at an alternative way to read the contents of the XML spec file. Everything points to having to put the spec file into a database and accessing it via an Entity bean using JDBC.
I'm not to happy about this at all as it means my clients will have to have a Database installed on their servers. Which they will have to pay for !!!
A "simple" XML file that we can copy to the server when / if the spec changes seems such a simpler cheaper way to do things.
Now in the Questions and Answers - Enterprise JavaBeans Tier - EJB Restrictions they suggest "Business data is better managed using a persistence interface such as JDBC, whose implementations usually provide these benefits. Read-only data can, however, be stored in files in a deployment JAR, and accessed with the getResource() or getResourceAsStream() methods of java.lang.Class
(see Why can't EJBs read and write files and directories in the filesystem? And why can't they access file descriptors?)
But Kathy Sierra says "So, if I'm understanding this thread correctly, using the classloader as a back door is not an option if you're writing to the spec, for portability." (see file handling through EJB)
Is a database and JDBC really my only option if I want to wite portable EJB software ???
[ August 26, 2003: Message edited by: Johannes de Jong ]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Johannes
First, I can't answer your question about how to access files from EJB, as I haven't don that, and I don't think it is the right way to store any other data then configuration data.
You don't need to use a expensive database, there are several Open Source databases as MySQL and PostgreSQL.
You don't need to make entity beans just for reading data in a database, only if you want the data it contains to be stored persistent in the database.
BR Jan
 
Johannes de Jong
tumbleweed
Bartender
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to use a expensive database, there are several Open Source databases as MySQL and PostgreSQL.
I do not have the luxury to choose my database. Its either DB2 or Oracle they are the standard databases used within the company I work for. My "clients" are other departments within our organization.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!