jdbc DataBaseMetaData + oracle 10g + dbunit + username..

If you are using DBUnit as tool for set up test environment in your oracle 10g then you have to provide the username of course. Normally it isn’t case sensitive in most tools. The jdbc driver or sqlplus let you create connection with lower case. DBUnit ask the DataBaseMetaData to get the defined tables in the schema. Schema and username are the same in the oracle world. So in DBUnit the source is

DatabaseMetaData databaseMetaData = jdbcConnection.getMetaData();
ResultSet resultSet = databaseMetaData.getTables(null, schema, "%", tableType);

where tableType is the String[] {“table”}. with schema == username lower case i get in my oracle 10.2 db nothing back. With upper case username et voila! Don’t know if this is really an standard behaviour….

JDBC Connection + Oracle 10g + recycle bin…

Since Oracle 10g dropped tables goes into a recycle bin: http://orafaq.com/node/968. These tables aren’t visible inside the admin site under the user but if you are using JDBC to access the schema. Thought first of a bug in SQL Explorer when i saw the huge list of tables starting with BIN$… Every time you drop tables more BIN$ you get… If someone needs such a future… I’m more a friend of the “know what i’m doing’ approach. The good thing is that this is a feature which you can disable:

  1. sqlplus sys/<your password> as sysdba
  2. SQL> purge dba_recyclebin;
  3. SQL> alter system set recyclebin = OFF scope=both;