1. Copy JDBC Driver to $JBOSS_HOME$/server/default/lib/-where is find this?
You mean you want to know where to find the JDBC jar file? Since you mention MySQL, the driver jar will be available here http://dev.mysql.com/downloads/connector/j/5.1.html. After you download that .tar/.zip, extract it to some folder. Inside that you will find a jar (ex: mysql-connector-java-5.1.8-bin.jar). Copy that jar to $JBOSS_HOME/server/default/lib
2. i copied the sample from $JBOSS_HOME$/docs/examples/jca/mysql-ds.xml
to $JBOSS_HOME$/server/default/deploy-is this all i need to do?
You will have to edit it to point to the correct database URL and the user name, password.
More details about the datasource configuration can be found here:
I have copied (mysql-connector-java-5.1.7-bin.jar). to $JBOSS_HOME/server/default/lib already so this is done.
So know i need to copy the $JBOSS_HOME/docs/examples/jca/mysql-ds.xml file to $JBOSS_HOME/server/default/deploy .
Then when this is done i only need to edit the mysql-ds.xml file. Replace <jndi-name>MySqlDS</jndi-name> with your datasource name,
Replace <connection-url>jdbc:mysql://mysql-hostname:3306/jbossdb</connection-url> with my connection string,
and then last username and pasword. Then all this should be finished i hope? Please let me know if this is all i need to do or if there are more things i need to change?
Thank you very much for your quick replay with this matter. I'll be back again if i don't get this to work but let's hope not. Cheers again for this!!!
Replace <jndi-name>MySqlDS</jndi-name> with your datasource name?
So with the above information what jndi-name should i use? I don't know what i am looking for here so please i need your help again...
The jndi name can be anything. You just have to remember that name so that you can use it while looking up your datasource in the code.
So if jndiname is:
Then your code to lookup the datasource (within the server) will be:
Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("java:xyz");