> For CMP bean how do you define which JDBC driver will be used.
> (in .xml or other property file)
> What is the defult driver
> How you can add you own driver with user and password, defines in xml
> 
> Thanks
> Adi Lev
> 
I think this belongs to jboss-user and not to jboss-dev..
anyhow

Recently I posted this kind of readme on jboss-user, works for any Database

Using MS SQLServer with the JDBC-ODBC Bridge (included in JDK since 1.2.x)
--------------------------------------------------------------------------
Should also work for other ODBC Datasources

1. Install ODBC Datasource <my_dsn>

2. Add sun.jdbc.odbc.JdbcOdbcDriver to jboss.properties:
 
jdbc.drivers=org.hsql.jdbcDriver,jdbc.idbDriver,sun.jdbc.odbc.JdbcOdbcDriver

3. Add MLet for Datasource in jboss.conf
   <MLET CODE = "org.jboss.jdbc.DataSourceImpl" ARCHIVE="rt.jar"
CODEBASE="../lib/ext/">
      <ARG TYPE="java.lang.String" VALUE="jdbc:odbc:my_dsn">
      <ARG TYPE="java.lang.String" VALUE="my_dsn">
      <ARG TYPE="java.lang.String" VALUE="sun.jdbc.odbc.JdbcOdbcDriver">
      <ARG TYPE="java.lang.String" VALUE="sa">
      <ARG TYPE="java.lang.String" VALUE="">
   </MLET>

4. Add Type-Mapping for MS SQLSERVER to the beans jaws.xml
  (was provided by Pedro Mota, maybe someone could add it to the
cvs/defaultjaws.xml)
    <type-mapping>
      <name>MS SQLSERVER</name>
      <mapping>
          <java-type>java.lang.Integer</java-type>
          <jdbc-type>INTEGER</jdbc-type>
          <sql-type>INTEGER</sql-type>
      </mapping>
      <mapping>
          <java-type>java.lang.Character</java-type>
          <jdbc-type>CHAR</jdbc-type>
          <sql-type>CHAR</sql-type>
      </mapping>
      <mapping>
          <java-type>java.lang.Short</java-type>
          <jdbc-type>SMALLINT</jdbc-type>
          <sql-type>SMALLINT</sql-type>
      </mapping>
      <mapping>
          <java-type>java.lang.Double</java-type>
          <jdbc-type>DOUBLE</jdbc-type>
          <sql-type>DOUBLE</sql-type>
      </mapping>
      <mapping>
          <java-type>java.lang.Long</java-type>
          <jdbc-type>DECIMAL</jdbc-type>
          <sql-type>DECIMAL(20)</sql-type>
      </mapping>
      <mapping>
          <java-type>java.lang.String</java-type>
          <jdbc-type>VARCHAR</jdbc-type>
          <sql-type>VARCHAR(256)</sql-type>
      </mapping>
      <mapping>
          <java-type>java.lang.Object</java-type>
          <jdbc-type>IMAGE</jdbc-type>
          <sql-type>IMAGE</sql-type>
      </mapping>
      <mapping>
          <java-type>java.lang.Byte</java-type>
          <jdbc-type>TINYINT</jdbc-type>
          <sql-type>TINYINT</sql-type>
      </mapping>
      <mapping>
          <java-type>java.sql.TimeStamp</java-type>
          <jdbc-type>TIMESTAMP</jdbc-type>
          <sql-type>TIMESTAMP</sql-type>
      </mapping>
      <mapping>
          <java-type>java.util.Date</java-type>
          <jdbc-type>DATETIME</jdbc-type>
          <sql-type>DATETIME</sql-type>
      </mapping>
      <mapping>
          <java-type>java.lang.Boolean</java-type>
          <jdbc-type>BIT</jdbc-type>
          <sql-type>BIT</sql-type>
      </mapping>
      <mapping>
          <java-type>java.lang.Float</java-type>
          <jdbc-type>FLOAT</jdbc-type>
          <sql-type>FLOAT</sql-type>
      </mapping>
    </type-mapping>

5. Edit your beans jaws.xml and tell your enterprise-beans to use
   a) the MS SQLSERVER Type-Mapping with
        <type-mapping>MS SQLSERVER</type-mapping>   
   b) your Datasource
        <datasource>my_dsn</datasource>

This has been testet with the banktest and worked only "half".
Jaws was able to init create the tables and to populate the table customers
but failed to insert data into accounts.


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to