3 Replies Latest reply on May 29, 2003 3:33 PM by ldolling

    initial configuration - any help?

    ldolling Newbie

      Hi,

      problem: datasource not bound

      installed:
      JBoss 3.2,x
      MySQL

      1) I can connect to MySQL via JDBC and JBoss directly. Tested. Works fine.
      2) Now I want to configure JBoss (default) access MySQL via JNDI and the JBoss datasource configuration.

      Problem:
      I get exception: "MySqlDB not bound"

      Code:
      ctx = new InitialContext();
      DataSource ds = (DataSource) ctx.lookup("MySqlDB");
      conn = ds.getConnection();

      What I did:
      1) QuickStart-30x.pdf, Chapter 10
      2) copying examples\jca\mysql-ds.xml to deploy
      3) editing the attributes to my needs (see below). Tested with direct access to MySQL
      -> doesn't work
      4) figured out HyperSonice example uses a security realm (also refered to in Docu), so I
      a) added security realm to mysql-ds.xml
      b) added security realm to login-config.xml and set it to NoTxCM (see below)
      c) set standardjaws.xml and standardjbosscmp-jdbc.xml
      java:/MySqlDB
      <datasource-mapping>mySQL</datasource-mapping>

      Still it doesn't work. Maybe someone has a general overview how to configure a datasource?

      Regards, Lars


      ----
      mysql-ds.xml:

      <local-tx-datasource>
      <jndi-name>MySqlDB</jndi-name>
      <connection-url>jdbc:mysql://localhost:3306/test</connection-url>
      <driver-class>com.mysql.jdbc.Driver</driver-class>
      <user-name>root</user-name>

      <min-pool-size>0</min-pool-size>
      <max-pool-size>100</max-pool-size>
      <security-domain>MySqlDbRealm</security-domain>
      </local-tx-datasource>


      login-config.xml
      <application-policy name = "MySqlDbRealm">

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

      </application-policy>