|
From: <tri...@tr...> - 2004-02-22 03:53:30
|
Colin, I think Rod did make it lazy init at some point, but the problem was that some jdbc driver (I think MS SQL Server) was not letting us use the connection after some exception was thrown. This prevented us from loading the meta data and the translation mapping. All we really need is the database product name, so if you could set that explicitly, then we don't need to look it up. There is already code in SQLErrorCodesFactory to avoid the database metadata lookup if you pass in a database product name. public SQLErrorCodes getErrorCodes(String dbName) I think all you need now is to do is create a custom SQLErrorCodeSQLExceptionTranslator where you set the database product name explicitly and load the error codes using this rather than the data source. Thomas Quoting Colin Sampaleanu <col...@ex...>: > I've been sitting here all day watching logs go by as I try to get a > system into production, and seeing a lot of pauses as the > new JdbcTemplate(dataSource) > in JdbcHelper causes, every single time JdbcHelper is created, the > exception metadata to be pulled from the DB. > > Now this is code using Spring slightly post RC1. I realize JdbcHelper > has gone away, but the same thing happens of course when you just do a > 'new JdbcTemplate(dataSource)' directly. > > I don't know why JdbcAccessor (and hence JdbcTemplate) really needs to > eager init the exception translator. The access method is synchronized, > so there should be no issues letting it lazy init. > > I would like to remove this eager init (in afterPropertiesSet()) of the > exception translator. Please let me know if you have a problem with > this. I was thinking that if somebody wants to still allow it to be > eagerly inited, for the case where JdbcTemplate is coming out of a > beanfactory/context then we can add a 'lazyInitExceptionTranslator' > property, which would default to true. > > Regards, > Colin > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |