hi, how does one catch a java.sql.SQLException: No suitable driver thrown while building the session factory or detect that one has been thrown?
as you can see below, i get a "10:44:50,484 WARN SettingsFactory:95 - Could not obtain connection metadata" before this happens.
the problem is that buildSessionFactory() does not throw, but returns normally. how does one find out programmatically that this error occurred?
thanks
10:44:46,000 INFO Main:126 - started at Fri Mar 19 10:44:45 PST 2004
10:44:47,156 INFO Main:14 - constructing main for jdbc:mysql://204.1.213.186:3306/geo_rtayek
10:44:47,156 INFO Main:16 - constructing configuration
10:44:47,296 INFO Environment:462 - Hibernate 2.1.2
10:44:47,312 INFO Environment:496 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.gjt.mm.mysql.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.hibernate.cache.HashtableCacheProvider, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=root, hibernate.connection.password=, hibernate.connection.pool_size=1}
10:44:47,312 INFO Environment:518 - using java.io streams to persist binary types
10:44:47,312 INFO Environment:519 - using CGLIB reflection optimizer
10:44:47,328 INFO Main:18 - configuring
10:44:47,328 INFO Configuration:329 - Mapping resource: geo_rtayek/hibernate/Airport.hbm.xml
10:44:47,843 INFO Binder:229 - Mapping class: geo_rtayek.hibernate.Airport -> airport
... <lot's more> ...
10:44:50,296 INFO Configuration:329 - Mapping resource: geo_rtayek/hibernate/User.hbm.xml
10:44:50,328 INFO Binder:229 - Mapping class: geo_rtayek.hibernate.User -> user
10:44:50,328 INFO Main:20 - configured, building session factory
10:44:50,328 INFO Configuration:595 - processing one-to-many association mappings
10:44:50,328 INFO Configuration:604 - processing one-to-one association property references
10:44:50,328 INFO Configuration:629 - processing foreign key constraints
10:44:50,406 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.MySQLDialect
10:44:50,406 INFO SettingsFactory:58 - Maximim outer join fetch depth: 1
10:44:50,406 INFO SettingsFactory:62 - Use outer join fetching: true
10:44:50,421 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
10:44:50,421 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 1
10:44:50,453 INFO DriverManagerConnectionProvider:71 - using driver: org.gjt.mm.mysql.Driver at URL: geo_rtayek
10:44:50,453 INFO DriverManagerConnectionProvider:72 - connection properties: {user=root, password=}
10:44:50,468 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
10:44:50,484 WARN SettingsFactory:95 - Could not obtain connection metadata
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:95)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1119)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:748)
at Main.<init>(Main.java:21)
at Main.main(Main.java:128)
10:44:50,484 INFO SettingsFactory:102 - Use scrollable result sets: false
10:44:50,484 INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): false
10:44:50,484 INFO SettingsFactory:108 - Optimize cache for minimal puts: false
10:44:50,484 INFO SettingsFactory:117 - Query language substitutions: {no='N', true=1, yes='Y', false=0}
10:44:50,484 INFO SettingsFactory:128 - cache provider: net.sf.hibernate.cache.HashtableCacheProvider
10:44:50,500 INFO Configuration:1080 - instantiating and configuring caches
10:44:50,593 INFO SessionFactoryImpl:119 - building session factory
10:44:52,453 INFO SessionFactoryObjectFactory:82 - no JNDI name configured
10:44:52,453 INFO UpdateTimestampsCache:35 - starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
10:44:52,468 INFO QueryCache:39 - starting query cache at region: net.sf.hibernate.cache.QueryCache
10:44:52,468 INFO Main:22 - session factory constructed
10:44:52,468 INFO Main:23 - main constructed
10:44:52,468 INFO Main:81 - start querying db: geo_rtayek
10:44:52,718 WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: 08001
10:44:52,718 ERROR JDBCExceptionReporter:46 - No suitable driver
10:44:52,718 ERROR JDBCExceptionReporter:38 - Cannot open connection
java.sql.SQLException: No suitable driver
_________________ <http://tayek.com/>, co-chair <http://www.ocjug.org/>, actively
seeking telecommuting work. hate spam?
<https://www1.ietf.org/mailman/listinfo/asrg>
|