Forums Register Login
OracleDatabaseMetaData.getColumns() returns an empty result set
Howdy Ranchers,

I've setup a dbunit unit test for some DAO's I worked on. I was using HSQL (which worked) and am moving it to Oracle 11g.

The data is loaded via dbunit's FlatXmlDataSetBuilder, Spring 2.5.6 LocalContainerEntityManagerFactoryBean and Hibernate 3.4 OracleDriver.

The database is setup using synonyms and I used dbunit's DabaseConfig.setProperty() method to set the table type to "SYNONYM". It was a bit of a struggle getting that figured out. I had to debug dbunit down into IMetadataHandler.getTables() to get that working.

I'm stuck now on the getColumns() problem and not sure what to look for. Google produced GRANT SELECT on the tables, but I'm able to do SELECTs from SQL Explorer in Eclipse. I'm not knowledgeable enough about SQL to know where the SELECT on table columns should be applied (if that is really the problem).

Anyone have any ideas?

- Doug

-- Nothing is impossible if ImPossible
There are several properties related to synonyms that affect the behavior of Oracle's JDBC driver.
I suggest you experiment with them.
They are detailed in the javadoc for class oracle.jdbc.OracleConnection.
The javadoc is available for download from this page.

Good Luck,
Thanks for the tip Avi,

Unfortunately, oracle.jdbc.OracleConnection is not what I need. org.dbunit.ext.oracle.OracleConnection is what I am using.

Too bad that class doesn't have the synonym properties as the Oracle JDBC class.

Anyway, we've gone with an alternative approach that is working.

Take care,
- Doug

-- Nothing is impossible if ImPossible

Doug Slattery wrote:Anyway, we've gone with an alternative approach that is working.

Could you share your approach in case others have similar issues?

Could you share your approach in case others have similar issues?


I was using org.dbunit.operation.DatabaseOperation.REFRESH.execute(connection, dataSet) in my base test class that gets extended by the unit tests to load the test data from an xml file. The xml file was created from a db export of a good test data set and could be used as is this way. It worked great with HSQL.

If the database is discovered by the class to be Oracle, it doesn't use that, and instead loads the test data via connection.createStatement().execute(<sql string>). The <sql string> is read from an sql file. The xml file data set was fairly small, so converting it to a bunch of inserts cost less than continuing to fight the other problem.

- Doug

-- Nothing is impossible if ImPossible
Curse your sudden but inevitable betrayal! And this tiny ad too!
ScroogeXHTML 7.1 - RTF to HTML5 / XHTML converter

This thread has been viewed 2195 times.

All times above are in ranch (not your local) time.
The current ranch time is
Feb 21, 2018 22:26:26.