⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 faq.html

📁 dfdfddfskfjdsklfjksdljflksjfsjlkfdjlksfjkdsjfsdjkflsjkf
💻 HTML
📖 第 1 页 / 共 3 页
字号:
    <li>          <a href="#columnfilter">           How to exclude some table columns         at runtime?                 </a>      </li>       <li>          <a href="#usertypeidentity">           How to use InsertIdentityOperation with user defined types?                 </a>      </li>       <li>          <a href="#customprimarykeys">           How to customize primary keys detection?                 </a>      </li>       </ol>       <p>          <strong>           Errors       </strong>       </p>       <ol>          <li>          <a href="#AmbiguousTableNameException">          Why I get a "AmbiguousTableNameException"?                 </a>      </li>       <li>          <a href="#fkconstraintviolation">             Why I get a "Foreign keys constraint violation" error?                 </a>      </li>       <li>          <a href="#typenotrecognized">            Why I get a "data type not recognized" warning?                 </a>      </li>       <li>          <a href="#clonedconnection">            Why I get a "Can't start a cloned connection"                 exception when I use InsertIdentityOperation?                 </a>      </li>       <li>          <a href="#UnsatisfiedLinkError">           Why I get an "UnsatisfiedLinkError"                 with the DB2 driver?                 </a>      </li>       </ol>       </div>      <div class="h3">                    <h3>          <a name="General">General</a>        </h3>                <dl>          <dt>          <a name="supportedvendors">             Which relational database systems are supported?                 </a>      </dt>       <dd>                        <p>           See the publicly maintained        <a href="http://www.dbunit.org/cgi-bin/wiki.pl?SupportedRDBMS">     list of compatible RDBMS   </a>        at the        <a href="http://www.dbunit.org/wiki/">     DbUnit Wiki.   </a>        Don't hesitate to contribute to this list, particularly for database not listed yet.       </p>                     </dd>       </dl>       <dl>          <dt>          <a name="build">             How to build DbUnit?                 </a>      </dt>       <dd>                        <p>          <a href=" http://www.dbunit.org/cgi-bin/wiki.pl?BuildingDbUnit">     BuildingDbUnit   </a>        detailed instruction.       </p>                     </dd>       </dl>       <dl>          <dt>          <a name="p6spy">          How to see SQL statements issued by DbUnit using P6Spy?                 </a>      </dt>       <dd>                       <p>          <a href="http://www.p6spy.com">     P6Spy   </a>        is a transparent JDBC proxy-driver               specialized to log the statements performed against the actual driver you normally would use.              Using p6spy would allow to log the SQL statements issued by DbUnit.                     </p>                     <p>           To install P6Spy, complete the following steps:                     <ol>                          <li>           Put the p6spy.jar file in your classpath.                       </li>       <li>           Move spy.properties into a directory listed in your classpath.  Unlike                JAR files, you do not directly reference your property file in the                classpath (e.g.: if you have the file c:\r\proj\confspy.properties make sure you                 put c:\r\proj\conf in the classpath).                       </li>       <li>           Modify your application to use the P6Spy database driver i.e.                com.p6spy.engine.spy.P6SpyDriver.                       </li>       <li>           Modify the realdriver line in the spy.properties file to reflect the                wrapped database driver. An example of a modified realdriver line follows:            	realdriver = oracle.jdbc.driver.OracleDriver                     </li>       </ol>              Installation is complete. When you run your application, a spy.log file is              generated in the same directory from where you run the application.               The log file contains a list of all of the database statements              executed. You can change both the destination of spy.log and what it logs by              editing the spy.properties file.       </p>                     </dd>       </dl>       <dl>          <dt>          <a name="knownfixedissues">             How to learn more about known and fixed issues?                 </a>      </dt>       <dd>                        <p>           Look at        <a href="http://www.dbunit.org/cgi-bin/wiki.pl?ChangesSinceLastRelease">     ChangesSinceLastRelease   </a>        and at        <a href="http://www.dbunit.org/issue-tracking.html">     Issue Tracking   </a>       .       </p>                     </dd>       </dl>       </div>      <div class="h3">                    <h3>          <a name="Using DbUnit">Using DbUnit</a>        </h3>                <dl>          <dt>          <a name="extract">             How to extract a flat XML dataset from my database?                 </a>      </dt>       <dd>                        <p>                 The following sample demonstrates how you can export one or many tables              from a database to an flat XML dataset file.                     <div id="source">      <pre>public class DatabaseExportSample{    public static void main(String[] args) throws Exception    {        // database connection        Class driverClass = Class.forName("org.hsqldb.jdbcDriver");        Connection jdbcConnection = DriverManager.getConnection(                "jdbc:hsqldb:sample", "sa", "");        IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);        // partial database export        QueryDataSet partialDataSet = new QueryDataSet(connection);        partialDataSet.addTable("FOO", "SELECT * FROM TABLE WHERE COL='VALUE'");        partialDataSet.addTable("BAR");        FlatXmlDataSet.write(partialDataSet, new FileOutputStream("partial.xml"));        // full database export        IDataSet fullDataSet = connection.createDataSet();        FlatXmlDataSet.write(fullDataSet, new FileOutputStream("full.xml"));    }}</pre>    </div>      </p>                     </dd>       </dl>       <dl>          <dt>          <a name="generatedtd">             How to generate a DTD representing my database schema?                 </a>      </dt>       <dd>                        <p>           The following sample demonstrates how you can generate a flat xml dataset                DTD from a database.       </p>                     <div id="source">      <pre>public class DatabaseExportSample{    public static void main(String[] args) throws Exception    {        // database connection        Class driverClass = Class.forName("org.hsqldb.jdbcDriver");        Connection jdbcConnection = DriverManager.getConnection(                "jdbc:hsqldb:sample", "sa", "");        IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);        // write DTD file        FlatDtdDataSet.write(connection.createDataSet(),                new FileOutputStream("test.dtd"));    }}</pre>    </div>                                  </dd>       </dl>       <dl>          <dt>          <a name="multipleschema">             Can I work with multiple database schemas having tables with identical name?                 </a>      </dt>       <dd>                   Yes, see        <a href="#AmbiguousTableNameException">     Why I get a "AmbiguousTableNameException"?   </a>       .                     </dd>       </dl>       <dl>          <dt>          <a name="identity">             Can I use DbUnit with IDENTITY or auto-increment                   columns?                 </a>      </dt>       <dd>                           <p>                    Many RDBMS allow IDENTITY and auto-increment columns to be overwritten with client values implicitly. DbUnit can be used with these RDBMS natively.        Some databases, like MS SQL Server and Sybase, need to explicitly activate client values writing. The way to activate this feature is vendor specific.                         <br>          </br>        DbUni        t provides this functionality for MS SQL Server with the        <a href="components.html#IdentityInsertOperation">     IdentityInsertOperation   </a>        class.                      </p>                     </dd>       </dl>       <dl>          <dt>          <a name="flatxmlnull">          How to specify NULL values with flat XML dataset?                 </a>      </dt>       <dd>                        <p>           See        <a href="components.html#FlatXmlDataSet">     FlatXmlDataSet documentation   </a>      </p>                     </dd>       </dl>       <dl>          <dt>          <a name="views">           Can I use DbUnit with database views?                  </a>      </dt>       <dd>                        <p>                 Yes. By default DbUnit is configured to only recognize normal tables. Modify the                      <a href="properties.html#tabletype">     table type property   </a>        to work with other table types.              For example, use        <code>           {"TABLE", "VIEW"}       </code>         for views.                     </p>                     <p>                 Be aware that REFRESH, DELETE and UPDATE operations are not compatible with tables without               primary keys. They are not usable with views without        <a href="#customprimarykeys">     overriding primary keys detection   </a>       . CLEAN_INSERT, INSERT and DELETE_ALL               operations are compatible with views.                     </p>                     </dd>       </dl>       <dl>          <dt>          <a name="batchstatement">           How to enable batched statement?                 </a>      </dt>       <dd>                 See        <a href="properties.html#batchstatement">     batched statement   </a>        feature.                     </dd>       </dl>       <dl>          <dt>          <a name="dateformat">           What are the dates formats supported by DbUnit?                 </a>      </dt>       <dd>                       <p>           DbUnit use the JDBC escape formats for string representation.                         <table border="1" width="100%" cellspacing="2" cellpadding="3">                                                <tr class="a">    <th>           Type       </th>       <th>           Format       </th>   </tr>                                            <tr class="b">    <td>           DATE       </td>       <td>           yyyy-mm-dd       </td>   </tr>                                            <tr class="a">    <td>           TIME       </td>       <td>           hh:mm:ss       </td>   </tr>                                            <tr class="b">    <td>           TIMESTAMP       </td>       <td>           yyyy-mm-dd hh:mm:ss.fffffffff       </td>   </tr>      </table>              </p>                     </dd>       </dl>       <dl>          <dt>          <a name="typefactory">            How to replace the default data type factory?                 </a>      </dt>       <dd>                        <p>           You can replace the default DbUnit        <a href="properties.html#typefactory">     data type factory   </a>        to get support for custom data type.         DbUnit provides extended factories for some vendors, which are located in        <code>           org.dbunit.ext       </code>         subpackages.                     </p>                     <p>           Here is how to setup the Oracle factory:               <div id="source">      <pre>    IDatabaseConnection connection = new DatabaseConnection(            jdbcConnection, schema);    DatabaseConfig config = connection.getConfig();    config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY,            new OracleDataTypeFactory());</pre>    </div>                    </p>                     <p>           Don't hesitate to submit your own implementation if you encounter types not currently supported by DbUnit.                      </p>                     </dd>       </dl>       <dl>          <dt>          <a name="streaming">             How to perform streamed import and export?                 </a>      </dt>       <dd>                          <p>                   Historically, DbUnit has memory consumption issues when working with very large dataset files. DbUnit 2.0 includes many improvements, like using SAX2 instead of the Electric XML parser and and streamed XML dataset writing, to overcome the memory consumption problems.                        </p>        	       <p>                   For compatibility reason, streamed export and import are not enabled by default. When working with large dataset, using this feature can make a huge difference.                       </p>        	       <h5>           	Database Export:                       </h5>        	       <p>           	Configure your DbUnit connection to use ForwardOnlyResultSetTable when exporting very         	large dataset. ForwardOnlyResultSetTable is a very efficient database table implemtation useful         	when random data access is not required. By default, DbUnit uses CachedResultSetTable which consume         	more memory but provides random data access.                       </p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -