|
From: Thomas R. <tri...@tr...> - 2003-03-08 21:32:10
|
Hi, > -- Thomas, were are with we your JDBC changes? This is perhaps the biggest > area of change nearly ready to go -- > -- I have just committed my changes to some of the JDBC classes. Most of my changes relate to the SQLExceptionTranslater functionality. I created an SQLExceptionTranslaterFactory that loads error codes defined in a file named 'sql-error-codes.xml'. This is done on startup, and whenever a new JdbcTemplate class is created it will get the SQLExceptionTranslater from this factory file. The factory will check to see what database is used and create a new SQLExceptionTranslater populated with the corresponding error codes for translation. If the database does not have a defined set of error codes, then we will fall back on using a SQLStateSQLExeptionTranslater. The 'sql-error-codes.xml' is loaded from the classpath with the XmlBeanFactory. For a Tomcat web app I put 'sql-error-codes.xml' in the WEB-INF\classes directory. In general, I tend to put this file in the same directory where I put the log4j.properties file. To use this functionality we need the XmlBeans classes as well as the core and jdbc classes. I added a task 'xmlbean' to the build script to build this extra jar file. I have the following jar files in my WEB-INF\lib directory: spring-core-0.8.jar, spring-jdbc-0.8.jar and spring-xmlbean-0.8.jar. I have tested and included a few codes for Oracle 9i, MySQL 4.0, PostgreSQL 7.3, Microsoft SQL Server 2000 and IBM DB2 8.1. Postgres does not use any error codes or sql state currently, so we will have to come up with an alternative strategy if we want some translations. Let me know if there are any issues. Thomas |