<?xml version="1.0"?>
<faqs>
    <super id="faq">FAQ</super>
    <super id="faq_mysql">MySQL FAQ</super>
    <name>MySQL FAQ</name>
    <faq>
        <question>How do I setup OpenEJB to use MySQL?</question>
        <answer id="configigure">
            <p>
        Here are my config files for getting the CMP entity example to 
work.  Note that the mm driver is no longer available from sourceforge and 
must now be directly downloaded from www.mysql.com and that the driver 
name has changed.  The config files below use the new driver pacakge/name 
and work with MySQL 4.0.3 beta on Windows2000.
</p>
<p>
The SQL statement used to create the employee table was:
</p>
<p>
<code>
create table employee (
   id integer primary key auto_increment,
   first_name varchar(15), 
   last_name varchar(15),
   email varchar(30)
);
</code>
</p>
<p>
<file name="openejb.conf"><![CDATA[
<?xml version="1.0"?>

<openejb>
  <Container id="Default CMP Container" ctype="CMP_ENTITY">
    Global_TX_Database c:/java/j2ee/openejb/hello_world_cmp/conf/hello.cmp_global_database.xml
    Local_TX_Database  c:/java/j2ee/openejb/hello_world_cmp/conf/hello.cmp_local_database.xml
  </Container>
  <Deployments jar="c:/java/j2ee/openejb/hello_world_cmp/employee.jar"/>
  <Connector id="Default JDBC Database">
    JdbcDriver  com.mysql.jdbc.Driver
    JdbcUrl     jdbc:mysql://localhost/openejb_cmp_example
    UserName    cso4309
    Password 
  </Connector>
  <SecurityService id="Default Security Service"/>
  <TransactionService id="Default Transaction Manager"/> </openejb>
]]>
</file>
</p>
<p>
<file name="hello.cmp_global_database.xml"><![CDATA[
<?xml version="1.0"?>

<database name="Global_TX_Database" engine="mysql">
    <jndi name="java:comp/env/jdbc/openejb_cmp_example" />
    <mapping href="c:/java/j2ee/openejb/hello_world_cmp/conf/hello.cmp_or_mapping.xml" /> 
</database>
]]>
</file>
</p>
<p>
<file name="hello.cmp_local_database.xml"><![CDATA[
<?xml version="1.0"?>

<database name="Local_TX_Database" engine="mysql" >

    <driver class-name="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost/openejb_cmp_example">
      <param name="user"     value="cso4309" />
      <param name="password" value="" />
    </driver>

    <mapping href="c:/java/j2ee/openejb/hello_world_cmp/conf/hello.cmp_or_mapping.xml" /> 
</database>
]]>
</file>
</p>
<p>
<file name="hello.cmp_or_mapping.xml"><![CDATA[
<?xml version="1.0"?>

<mapping>
  <class name="org.acme.employee.EmployeeBean" identity="id" key-generator="IDENTITY">
    <map-to table="employee"/>
    <field name="id" type="integer" direct="true">
      <sql name="id" type="integer"/>
    </field>
    <field name="firstname" type="string" direct="true">
      <sql name="first_name" type="varchar" dirty="check"/>
    </field>
    <field name="lastname" type="string" direct="true">
      <sql name="last_name" type="varchar" dirty="check"/>
    </field>
    <field name="email" type="string" direct="true">
      <sql name="email" type="varchar" dirty="check"/>
    </field>
  </class>
</mapping>
]]>
</file>
</p>
</answer>
    </faq>
    <faq>
        <question>Where can i get the MySQL JDBC driver?</question>
        <answer id="track">
            <p>
The mm driver is no longer available from sourceforge, the new driver is 
called Connector/J and must now be directly downloaded from 
www.mysql.com at <a 
href="http://www.mysql.com/downloads/api-jdbc-stable.html">
http://www.mysql.com/downloads/api-jdbc-stable.html</a> 
        </p>
        </answer>
    </faq>

</faqs>
