Reputation: 950
I'm trying to generate with "MyBatis Generator" mappers from three tables, the first two are in one database (derby sample) and the last one is in another database (BIRT sample).
I'm using RAD 8.5 with derby.
Here is my xml configuration file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<classPathEntry location="C:\Users\XXX\IBM\rationalsdp\workspace\Example\WebContent\WEB-INF\lib\derby.jar"/>
<!-- Primo database -->
<context id="DerbyTables" targetRuntime="MyBatis3">
<jdbcConnection driverClass="org.apache.derby.jdbc.EmbeddedDriver"
connectionURL="jdbc:derby:C:\Users\XXX\IBM\rationalsdp\workspace\.metadata\.plugins\com.ibm.datatools.db2.cloudscape.driver\SAMPLE;create=true"
userId="admin" password="admin">
</jdbcConnection>
<javaTypeResolver >
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<javaModelGenerator targetPackage="test.model" targetProject="Example\src">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="test.dao.samp" targetProject="Example">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER" targetPackage="test.dao"
targetProject="Example\src">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<table schema="SAMP" tableName="STAFF" domainObjectName="staff">
<property name="useActualColumnNames" value="true" />
</table>
<table schema="SAMP" tableName="SALES" domainObjectName="sales">
<property name="useActualColumnNames" value="true" />
</table>
</context>
<!-- Secondo database -->
<context id="SecondTables" targetRuntime="MyBatis3">
<jdbcConnection driverClass="org.apache.derby.jdbc.EmbeddedDriver"
connectionURL="jdbc:derby:C:\Users\XXX\IBM\rationalsdp\workspace\.metadata\.plugins\org.eclipse.birt.report.data.oda.jdbc.dbprofile.sampledb/db/BirtSample;create=true"
userId="admin" password="admin">
</jdbcConnection>
<javaTypeResolver >
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<javaModelGenerator targetPackage="test.model" targetProject="Example\src">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="test.dao.samp" targetProject="Example">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER" targetPackage="test.dao"
targetProject="E\src">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<table schema="CLASSICMODELS" tableName="OFFICES" domainObjectName="offices">
<property name="useActualColumnNames" value="true"/>
</table>
</context>
</generatorConfiguration>
When I click right on the generator configuration file I get the following error:
Failed to start database
'C:\Users\XXX\IBM\rationalsdp\workspace\.metadata\.plugins\org.eclipse.birt.report.data.oda.jdbc.dbprofile.sampledb/db/BirtSample' with class loader java.net.URLClassLoader@5ffe2fe7, see the next exception for details.
Failed to start database 'C:\Users\XXX\IBM\rationalsdp\workspace\.metadata\.plugins\org.eclipse.birt.report.data.oda.jdbc.dbprofile.sampledb/db/BirtSample' with class loader java.net.URLClassLoader@5ffe2fe7, see the next exception for details.
I couldn't find any guide for this issue.
Does somebody know where is my error or know some guide about mybatis generator with multiple dbs?
Upvotes: 0
Views: 1923
Reputation: 1
It looks like you are trying to connect to the BIRT sample database. Your Derby database is probably already up. You can add a ;shutdown=true and run once then leave off the the create=true and retry your generation.
Upvotes: 0