PDA

View Full Version : Specify Database Vendor



netdawg
Sep 2nd, 2004, 03:43 PM
In the interest of efficiency, can we specify the RDBMS vendor somewhere, so the framework does not have to do this for every single database command (Thanks):

Sep 2, 2004 10:41:58 AM org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions

INFO: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]

Sep 2, 2004 10:41:59 AM org.springframework.beans.factory.support.Abstract BeanFactory getBean

INFO: Creating shared instance of singleton bean 'DB2'

Sep 2, 2004 10:41:59 AM org.springframework.beans.factory.support.Abstract BeanFactory getBean

INFO: Creating shared instance of singleton bean 'HSQL'

Sep 2, 2004 10:41:59 AM org.springframework.beans.factory.support.Abstract BeanFactory getBean

INFO: Creating shared instance of singleton bean 'MS-SQL'

Sep 2, 2004 10:41:59 AM org.springframework.beans.factory.support.Abstract BeanFactory getBean

INFO: Creating shared instance of singleton bean 'MySQL'

Sep 2, 2004 10:41:59 AM org.springframework.beans.factory.support.Abstract BeanFactory getBean

INFO: Creating shared instance of singleton bean 'Oracle'

Sep 2, 2004 10:41:59 AM org.springframework.beans.factory.support.Abstract BeanFactory getBean

INFO: Creating shared instance of singleton bean 'Informix'

Sep 2, 2004 10:41:59 AM org.springframework.beans.factory.support.Abstract BeanFactory getBean

INFO: Creating shared instance of singleton bean 'PostgreSQL'

Sep 2, 2004 10:41:59 AM org.springframework.beans.factory.support.Abstract BeanFactory getBean

INFO: Creating shared instance of singleton bean 'Sybase'

Sep 2, 2004 10:41:59 AM org.springframework.jdbc.support.SQLErrorCodesFact ory <init>

INFO: SQLErrorCodes loaded: [HSQL Database Engine, Oracle, Sybase SQL Server, Microsoft SQL Server, Informix Dynamic Server, PostgreSQL, DB2*, MySQL]

Sep 2, 2004 10:41:59 AM org.springframework.jdbc.support.SQLErrorCodesFact ory getErrorCodes

INFO: Looking up default SQLErrorCodes for DataSource

Sep 2, 2004 10:42:01 AM org.springframework.jdbc.support.SQLErrorCodesFact ory getErrorCodes

INFO: Database Product Name is Oracle

Sep 2, 2004 10:42:01 AM org.springframework.jdbc.support.SQLErrorCodesFact ory getErrorCodes

INFO: Driver Version is 9.0.1.4.0

Sep 2, 2004 10:42:01 AM org.springframework.jdbc.object.RdbmsOperation compile

INFO: RdbmsOperation with SQL [SELECT whatever FROM sometable WHERE status = 'A' ORDER BY create_date DESC] compiled

netdawg
Sep 2nd, 2004, 10:00 PM
:roll: ...never mind...I see you cache the datasource if it is created by the container...impressive!!

From Tomcat logs:

---

INFO: Driver Version is 9.0.1.4.0
Sep 2, 2004 3:44:33 PM org.springframework.jdbc.object.RdbmsOperation compile
INFO: RdbmsOperation with SQL [SELECT whatever FROM sometable WHERE status = 'A' ORDER BY create_date DESC] compiled
Sep 2, 2004 3:49:38 PM org.springframework.jdbc.support.SQLErrorCodesFact ory getErrorCodes
INFO: Looking up default SQLErrorCodes for DataSource
Sep 2, 2004 3:49:38 PM org.springframework.jdbc.support.SQLErrorCodesFact ory getErrorCodes
INFO: Database product name found in cache for DataSource [org.apache.commons.dbcp.BasicDataSource@55e]. Name is 'Oracle'.
Sep 2, 2004 3:49:38 PM org.springframework.jdbc.object.RdbmsOperation compile
INFO: RdbmsOperation with SQL [SELECT whatever FROM sometable WHERE status = 'A' ORDER BY create_date DESC] compiled
Sep 2, 2004 3:50:34 PM org.springframework.jdbc.support.SQLErrorCodesFact ory getErrorCodes
INFO: Looking up default SQLErrorCodes for DataSource
Sep 2, 2004 3:50:34 PM org.springframework.jdbc.support.SQLErrorCodesFact ory getErrorCodes
INFO: Database product name found in cache for DataSource [org.apache.commons.dbcp.BasicDataSource@55e]. Name is 'Oracle'.
Sep 2, 2004 3:50:34 PM org.springframework.jdbc.object.RdbmsOperation compile
INFO: RdbmsOperation with SQL [SELECT whatever FROM sometable WHERE status = 'A' ORDER BY create_date DESC] compiled

Rod Johnson
Sep 3rd, 2004, 01:19 AM
Remember also that JdbcTemplate and JDBC operation superclasses are threadsafe, so you shouldn't be creating instances for every JDBC operation.