1) Is it correct that a Session Beans reads infosfrom a "normal" file or it must must be connected only to a database
EJB2.0 specification in section 24.1.2 lists the "Programming Restrictions" that a bean developer should follow. One of them says -
"An enterprise bean must not use java.io package to attempt to access files and directories in the file system."
As an explanation for this restriction it says - The file system APIs are not well suited for business components to access data. Business components should use a resource manager API such as JDBC to store data.
So if you want to strictly follow the "rules" the answer is - No, you should not read from the file.
But then, I can't see any technical difficulty as such on reading a file. You can certainly open and read a file from a session bean (don't think the appserver will prevent such a thing). The messy part would be - how do you obtain the location of the file. You can use an environment variable (java -D option or through the session bean environment set up in the deployment descriptor) that points to the file location.
2) There are differences, for what concerne question n.1,among Session Beans and Entity Beans ?
Did not understand your question.
My Application Server (JBoss) runs on a linux serverand PostgresDB on another linux server, but is simpleto say to JBoss where PostgresDB is.If the file resides on a server different from the Server Linux where JBoss runs, how can I read the file ?
You can share the file on the network and use NFS to read the file from the computer where your application server is running.