3 Replies Latest reply on Sep 29, 2002 11:21 PM by Juan M.

    Unable to connect to mysql database inspite of ...

    shaikaman Newbie

      Hi all,

      I'm unable to solve a simple which you all might
      have done earlier.

      I've jboss-3.0.2 (binary installation)
      mysql database(3.23) and mm.mysql driver.

      I'm testing a simple test program with a servlet,jsp.
      Servlet has the database connection using ds.

      -------------------------------------------------------
      initialContext = new InitialContext();
      DataSource dataSource = (DataSource)
      initialContext.lookup("java:comp/env/MySqlDS");
      return dataSource.getConnection();
      ----------------------------------------------------------

      -------web.xml --------------

      <resource-ref>
      <res-ref-name>MySqlDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      -----------------------------

      I'm not able to connect to the database as a NamingNotFound
      Exception is thrown:

      These are the steps i've taken to connect to database,
      not working.

      > I put the mm.mysql.jar into server/default/deploy directory


      > copied jboss.jcml to server/default/conf directory

      ------ jboss.jcml ---


      org.gjt.mm.mysql.Driver



      org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl
      MySqlDS
      jdbc:mysql://server.techmines.com/VULCAN23
      root


      ---------------------

      > Edited standardjaws.xml

      -------- standardjaws.xml -----------
      java:/MySqlDS
      <type-mapping>mySQL</type-mapping>
      --------------------------------------

      > Edited mysql-service.xml

      --------- mysql-service.xml ------------

      <!--uncomment out this line if you are using the MySqlDbRealm above -->
      MySqlDbRealm

      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->


      MySqlDS



      <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://server.techmines.com/VULCAN23</config-property>
      <config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property>
      <!--set these only if you want only default logins, not through JAAS -->
      <config-property name="UserName" type="java.lang.String">root</config-property>
      <config-property name="Password" type="java.lang.String"></config-property>




      -----------------------------------------

      > Edited login-config.xml

      ----------- login-config.xml --------------

      <application-policy name = "MySqlDbRealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
      <module-option name = "principal"></module-option>
      <module-option name = "userName">root</module-option>
      <module-option name = "password"></module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MySqlDS</module-option>
      </login-module>

      </application-policy>
      ------------------------------------------

      Still, I get NamingException caught at : javax.naming.NamingException:
      Could not dereference object

      I'm really struck with this problem for the past few days.

      Please specify the steps where i went wrong or do i need to
      add few more configuration changes.
      I'm sweating with this problem, and Feedback Excepted sooon.