Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Wednesday, 26 November 2008

java.lang.ClassCastException: oracle.sql.BLOB

This is by far the most annoying problem I've ever had. What ClassCastException??? This is my code:

oracle.sql.BLOB blob = (oracle.sql.BLOB) resultSet.getObject("fileBlob");

It turned out that there are 2 Oracle JDBC jars in my Tomcat directory (common/lib and WEB-INF/lib), so I removed the one from WEB-INF, restarted the application, and it all worked fine.

Thursday, 20 March 2008

Schema Spy

SchemaSpy is a database reverse engineering tool that generates information about your database, including relationships, constraints, columns, and it even detects potential anomalies that may exist in your database. In order to maximise the benefit, you'd need to install GraphViz so that the HTML report would include nice graphical stuff.

I recently downloaded both software and run it against an Oracle database with this command:

# java -jar schemaSpy_3.1.1.jar -cp "D:\oraclexe\..\jdbc\lib\ojdbc14.jar"
-t ora -db [dbname] -s [schema] -u [user] -p [password] -cid -o output

I installed the latest Oracle Express Edition so that I get the latest Oracle client and JDBC driver. Make sure ORACLE_HOME is set, and include "GraphViz\bin" and "ORACLE_HOME\bin" in your PATH.
Share |