• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

OracleDatabaseMetaData.getColumns() returns an empty result set  RSS feed

 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks,
- Doug

-- Nothing is impossible if ImPossible
 
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doug,
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,
Avi.
 
Doug Slattery
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
author
Bartender
Posts: 4096
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Doug Slattery
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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



Sure.

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.

Thanks,
- Doug

-- Nothing is impossible if ImPossible
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!