[解决方法]org.dbunit.dataset.NoSuchTableException: Did not find table 'tab1' in schema 'null'
来源:互联网 发布:nginx允许ip和域名 编辑:程序博客网 时间:2024/06/05 12:05
DBunit从本地数据库中取得dataset,利用dataset获取表名为'tab1'的表时报该错误,代码如下
Class.forName(Configuration.JDBC_DRIVE);Connection conn = DriverManager.getConnection(Configuration.JDBC_URL, Configuration.JDBC_USERNAME, Configuration.JDBC_PASSWORD);connection = new DatabaseConnection(conn);DatabaseConfig config = connection.getConfig();config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());IDataSet databaseDataSet = connection.createDataSet();ITable actualTable = databaseDataSet.getTable(tableName);
奇怪的是在windows下该代码并不会报这个错误,linux下却有,网上查了很多资料,有说修改mysql表明大小写敏感值的,有说config.setProperty的FEATURE_CASE_SENSITIVE_TABLE_NAMES设为false的,结果都没解决问题,后来想了折中的方法:FEATURE_CASE_SENSITIVE_TABLE_NAMES设为true,传入的tableName一律为大写,问题解决了。。。。代码如下
Class.forName(Configuration.JDBC_DRIVE);Connection conn = DriverManager.getConnection(Configuration.JDBC_URL, Configuration.JDBC_USERNAME, Configuration.JDBC_PASSWORD);connection = new DatabaseConnection(conn);DatabaseConfig config = connection.getConfig();config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());config.setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, Boolean.TRUE);IDataSet databaseDataSet = connection.createDataSet();ITable actualTable = databaseDataSet.getTable(tableName);
- [解决方法]org.dbunit.dataset.NoSuchTableException: Did not find table 'tab1' in schema 'null'
- 遭遇org.dbunit.dataset.NoSuchTableException
- Table configuration with catalog null, schema orcl, and table ORDERS did not resolve to any tables
- dbunit之org.dbunit.dataset.DataSetException: java.net.MalformedURLException解决方法
- Setting property 'source' to 'org.eclipse.jst.jee.server:webProject' did not find a matching property
- Setting property 'source' to 'org.eclipse.jst.jee.server:webProject' did not find a matching propert
- Setting property 'source' to 'org.eclipse.jst.jee.server:webProject' did not find a matching propert
- etting property 'source' to 'org.eclipse.jst.jee.server:*did not find a matching property
- Setting property 'source' to 'org.eclipse.jst.jee.server:webProject' did not find a matching propert
- Setting property 'source' to 'org.eclipse.jst.jee.server:webProject' did not find a matching propert
- Setting property 'source' to 'org.eclipse.jst.jee.server:webProject' did not find a matching propert
- Jetty9 NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
- Setting property 'source' to 'org.eclipse.jst.jee.server:webProject' did not find a matching propert
- Setting property 'source' to 'org.eclipse.jst.jee.server:webProject' did not find a matching propert
- Setting property 'source' to 'org.eclipse.jst.jee.server:webProject' did not find a matching propert
- Eclipse报错:Setting property 'source' to 'org.eclipse.jst.jee.server:fzxt_tj' did not find
- Tomcat无法启动org.eclipse.jst.jee.server:xxx' did not find a matching property
- Setting property 'source' to 'org.eclipse.jst.jee.server:jeecg' did not find a matching property
- Note for The Art of Unix Programming(持续更新)
- 人人网面试
- 孙陶然致电商创业者:不存在不赚钱的商业模式
- java中静态代码块的用法 static用法详解
- 关于LINUX fread的问题
- [解决方法]org.dbunit.dataset.NoSuchTableException: Did not find table 'tab1' in schema 'null'
- MySQL的双机热备份(一)--MySQL的主从复制
- POSIX的线程的取消点(Cancellation Point)的概念和实现方式
- 吸取教训:做事情一定要要形成文档
- SSH C3P0连接池连接数总结
- 开始注意技术积累
- Linux目录结构
- 要执行请求的操作,WordPress 需要访问您网页服务器的权限。 请输入您的 FTP 登录XXXX完美解决方法
- mysql 日志清理