2 Replies Latest reply on Aug 15, 2002 9:21 AM by David Jencks

    MySQL question/JBoss3 question...

    declan boylan Newbie

      Just wondering if i'm doing this the right way...

      First i copy the mysql-service.xml into the deploy folder from the doc/jca...

      Correct me if i 'm wrong, but if i am to add those extra lines to the login-conf.xml then i do not have to do a db call as follows...

      dbConn = DriverManager.getConnection("jdbc:mysql://","username","password");

      but as follows...
      dbConn = DriverManager.getConnection("jdbc:mysql://");

      Is there anything else i should know about connecting to a db?

        • 1. Re: MySQL question/JBoss3 question...
          Luc Vu Newbie

          That's the idea. You can also add username and password in the mysql-service.xml itself.

          • 2. Re: MySQL question/JBoss3 question...
            David Jencks Master

            Whether you use the login-conf.xml setup or specify the user/pw in your mysql-service.xml file, you should be getting a connection like this:

            DataSource ds = (DataSource) new InitialContext().lookup("java:/mysqljndiname");
            Connection con = ds.getConnection();
            try {
            (do work)
            finally {

            where mysqljndiname is the jndi name you specified in mysql-service.xml

            Be sure you have the correct version mysql-service.xml file for your jboss version. There have been many small incompatible changes. One that came with a binary download should be ok for that version.