The ideea is that components need to be App Server independent. Could it be said "use the default datasource of the App Server". The method that i used till now(I'm using JBoss AS) to connect to the database is that i have this mysql-ds.xml which binds MySqlDS to JNDI.
So whenever i want to talk to the database i say Context ctx=new InitialContext(); DataSource ds=(javax.sql.DataSource) ctx.lookup("MySqlDS");
But what would happen if i needed to deploy the bean on an appserver that does not have a MySqlDS(i gave it that name) entry in the JNDI.
I don't understand what good does it do to write the ejb-jar.xml <resource-ref> <res-ref-name>EntityDS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> maybe here it lies the answer to the use the default conection problem
Does the <res-type>javax.sql.DataSource</res-type> mean use the default connection of the server to a database?
But how do you specify which datase(catalog) to use? Only place where I've seen it is in the <connection-url>jdbc:mysql://localhost:3306/database_name</connection-url> in the mysql-ds.xml
Problem is that i think there has to be another way. I mean u would not edit mysql-ds.xml and put a new <datasources> entry with the name that a new bean uses and point to the database(catalog) that my bean's tables are inside of, and stop the server and get it back online. You don;t bring down the appserver whenever a bean needs to be deployed.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com