BIRT - org.eclipse.birt.data.engine.odaconsumer.OdaDataException:无法获取结果集元数据

时间:2015-07-14 13:57:24

标签: mysql eclipse exception jdbc birt

在BIRT中,当我尝试从我的localhost获取记录时,它的工作正常。但是,当我尝试使用远程连接时,我收到如下所示的错误:

错误:

org.eclipse.birt.data.engine.odaconsumer.OdaDataException: Cannot get the result set metadata.
        org.eclipse.birt.report.data.oda.jdbc.JDBCException: SQL statement does not return a ResultSet object.
    SQL error #1:Table 'test.TBLUSERS' doesn't exist ... 63 more

Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'testbms.TBLUSERS' doesn't exist

    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)

    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)

注意:

  

表名自动更改为大写字母,因为它。   因为客户端服务器是linux并且它是区分大小写的。   但它显示列名但不显示记录。我一点击   完成后,我得到下图中指定的错误。

参考图片:

enter image description here

正如您在上图中所看到的,它已填充第二行中的表列

他们是否需要为远程连接完成任何特殊配置,或者我做错了什么?

1 个答案:

答案 0 :(得分:0)

As you stated, it is probably a case of case-sensitivity:

http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html

Although database and table names are not case sensitive on some platforms, you should not refer to a given database or table using different cases within the same statement. The following statement would not work because it refers to a table both as my_table and as MY_TABLE: mysql> SELECT * FROM my_table WHERE MY_TABLE.col=1;

If your development box isn't case sensitive then when you change the case of your tablename to match that on production you'll still be able to test. There might also be a way in MySQL using system tables. (See the following query for an example of querying to see if a table exists.):

SELECT count(*) 
FROM information_schema.tables 
WHERE table_schema = <schema-or-db-name> 
AND table_name = <table-or-view-name>

but more realistically, your target database should be passed to your report through a variable that you can check in the scripting of the dataset. Set the "this.query" value to equal the appropriate query based on that variable's value.

E.G.:

if ( params["source_db"].value == "Server=myProductionAddress;Database=myProductionDB;Uid=myUsername;Pwd=myPassword;" )
{
  this.query = "SELECT .... prodTableName";
}
else
{
  this.query = "SELECT .... devTableName";
}