The <jdbcConnection> Element
The <jdbcConnection> element is used to specify the properties of the database connection required to introspect tables. MyBatis Generator uses JDBC's DatabaseMetaData class to discover the properties of the tables you specify in the configuration. One <jdbcConnection> element is required for each <context> element.
Required Attributes
Attribute | Description |
---|---|
driverClass | The fully qualified class name for the JDBC driver used to access the database. |
connectionURL | The JDBC connection URL used to access the database. |
Optional Attributes
Attribute | Description |
---|---|
userId | The user ID used to connect to the database. |
password | The password used to connect to the database. |
Child Elements
- <property> (0..N) Note: any properties specified here will be added to the properties of the JDBC driver.
Example
This element will connect to a DB2 database configured as MBGTEST in the DB2 client configuration utility, using the default install location for the JDBC driver:
<jdbcConnection driverClass="COM.ibm.db2.jdbc.app.DB2Driver" connectionURL="jdbc:db2:MBGTEST" userId="db2admin" password="db2admin"> </jdbcConnection>