Configuring JNDI Datasource (MySQL-5.1.36) in JBOSS 5.1.0GA


General J2EE: Configuring JNDI Datasource (MySQL-5.1.36) in JBOSS 5.1.0GA

  1. I am running eclipse 3.4 with the above MYSQL and JBoss. Now i need to configure JNDI datasource to get all this to work. The problem i have with this is that it is all very new to me so i wonder if there is anybody who can give me some help with this, where to start and how to make this in an easy way for a beginner like my self. I have read that i need to do this but i need help with this. 1. Copy JDBC Driver to $JBOSS_HOME$/server/default/lib/-where is find this? 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? So if i get it right i only need to write one xml-file for this or am i wrong? Please help me somebody with this who know this better then i do. Or guide me in the right way where i can read and solve this by my self.
  2. This is the url where mysql jdbc driver can be downloaded download the connector, unzip it. Inside the unzipped folder, mysql-connector-java-5.1.7-bin.jar exists. Put that jar file in $JBOSS_HOME/server/default/lib folder. after copying mysql-ds.xml file into deploy folder, modify the properties (connection-url, username, password) in xml to match your mysql server properties. when you run jboss, you can see jboss loading mysql-ds.xml on console output or $JBOSS_HOME/server/default/log/server.log.
  3. I have done all this now but i have a problem with the thing below here. Replace MySqlDS 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 some help here... Thank you for your replay to this issue...
  4. jndi name[ Go to top ]

    How do you get your datasource in your application. Can you post your code? To help you, you should see somewhere in your code the following: DataSource ds = (DataSource)ctx.lookup( "java:comp/env/jdbc/TestDB") can you find that piece of code?