java.sql.SQLException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Synopsis: When running SchemaExport from a Java program SQL exceptions are not caught in application catch clause. This means I am unable to detect programmatically if there is a failure in SchemaExport. I invoke SchemaExport with the following code: try { Configuration l_Configuration = new Configuration(); l_Configuration.configure(); SchemaExport l_SchemaExport = new SchemaExport( l_Configuration ); l_SchemaExport.create( true, true ); } catch ( Exception ex ) { System.out.println( "catch received" ); } In this case the MySQL database has not been started. Even though there is an exception it is never caught in the application catch. Here is the SchemaExport log: Mar 24, 2004 12:49:45 PM net.sf.hibernate.cfg.Environment <clinit> INFO: Hibernate 2.1.2 Mar 24, 2004 12:49:45 PM net.sf.hibernate.cfg.Environment <clinit> INFO: hibernate.properties not found Mar 24, 2004 12:49:45 PM net.sf.hibernate.cfg.Environment <clinit> INFO: using CGLIB reflection optimizer Mar 24, 2004 12:49:45 PM net.sf.hibernate.cfg.Configuration configure INFO: configuring from resource: /hibernate.cfg.xml Mar 24, 2004 12:49:45 PM net.sf.hibernate.cfg.Configuration getConfigurationInputStream INFO: Configuration resource: /hibernate.cfg.xml Mar 24, 2004 12:49:45 PM net.sf.hibernate.cfg.Configuration addResource INFO: Mapping resource: HibernateMapping.xml Mar 24, 2004 12:49:45 PM net.sf.hibernate.cfg.Binder bindRootClass INFO: Mapping class: com.digitalwake.datamanager.Root -> Root Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Binder bindRootClass INFO: Mapping class: com.digitalwake.datamanager.Organization -> Organization Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Binder bindRootClass INFO: Mapping class: com.digitalwake.datamanager.Attribute -> Attribute Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Binder bindRootClass INFO: Mapping class: com.digitalwake.datamanager.DataType -> DataType Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Binder bindSubclass INFO: Mapping subclass: com.digitalwake.datamanager.TextType -> DataType Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Binder bindSubclass INFO: Mapping subclass: com.digitalwake.datamanager.URLType -> DataType Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Binder bindSubclass INFO: Mapping subclass: com.digitalwake.datamanager.NumericType -> DataType Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Binder bindSubclass INFO: Mapping subclass: com.digitalwake.datamanager.TimeType -> DataType Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Configuration doConfigure INFO: Configured SessionFactory: null Mar 24, 2004 12:49:46 PM net.sf.hibernate.dialect.Dialect <init> INFO: Using dialect: net.sf.hibernate.dialect.MySQLDialect Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-many association mappings Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Binder bindCollectionSecondPass INFO: Mapping collection: com.digitalwake.datamanager.Root.Organizations -> Organization Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Binder bindCollectionSecondPass INFO: Mapping collection: com.digitalwake.datamanager.Root.DataTypes -> DataType Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Binder bindCollectionSecondPass INFO: Mapping collection: com.digitalwake.datamanager.Organization.Attributes -> Attribute Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-one association property references Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing foreign key constraints Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-many association mappings Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-one association property references Mar 24, 2004 12:49:46 PM net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing foreign key constraints Mar 24, 2004 12:49:46 PM net.sf.hibernate.tool.hbm2ddl.SchemaExport execute INFO: Running hbm2ddl schema export Mar 24, 2004 12:49:46 PM net.sf.hibernate.tool.hbm2ddl.SchemaExport execute INFO: exporting generated schema to database Mar 24, 2004 12:49:46 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: Using Hibernate built-in connection pool (not for production use!) Mar 24, 2004 12:49:46 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: Hibernate connection pool size: 20 Mar 24, 2004 12:49:46 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql:///DigitalWake Mar 24, 2004 12:49:46 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: connection properties: {} Mar 24, 2004 12:49:47 PM net.sf.hibernate.tool.hbm2ddl.SchemaExport execute SEVERE: schema export unsuccessful java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused: connect at com.mysql.jdbc.Connection.createNewIO(Connection.java:1690) at com.mysql.jdbc.Connection.<init>(Connection.java:427) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:395) at java.sql.DriverManager.getConnection(DriverManager.java:512) at java.sql.DriverManager.getConnection(DriverManager.java:140) at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:95) at net.sf.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:119) at net.sf.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:84) at com.digitalwake.datamanager.test.createSchemaTest(test.java:48) at com.digitalwake.datamanager.test.main(test.java:37)
    via by Bruce Scott,
  • Nightmare Linux Installation
    via xplanner by jnah
    ,
  • Problems with mysql
    via xplanner by jareso
    ,
    • java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.ConnectException: Connection timed out: connect at com.mysql.jdbc.Connection.createNewIO(Connection.java:1631) at com.mysql.jdbc.Connection.<init>(Connection.java:524) at com.mysql.jdbc.Driver.connect(Driver.java:359) at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:414) at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:155) at com.sun.enterprise.resource.JdbcUrlAllocator.createResource(JdbcUrlAllocator.java:88) at com.sun.enterprise.resource.IASNonSharedResourcePool.createSteadyResources(IASNonSharedResourcePool.java:856) at com.sun.enterprise.resource.IASNonSharedResourcePool.initPool(IASNonSharedResourcePool.java:416) at com.sun.enterprise.resource.IASNonSharedResourcePool.internalGetResource(IASNonSharedResourcePool.java:625) at com.sun.enterprise.resource.IASNonSharedResourcePool.getResource(IASNonSharedResourcePool.java:520) at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:263) at com.sun.enterprise.resource.JdbcXAConnection.<init>(JdbcXAConnection.java:74) at com.sun.enterprise.resource.SystemJdbc10XaAllocator.createResource(SystemJdbc10XaAllocator.java:52) at com.sun.enterprise.resource.IASNonSharedResourcePool.createSteadyResources(IASNonSharedResourcePool.java:856) at com.sun.enterprise.resource.IASNonSharedResourcePool.initPool(IASNonSharedResourcePool.java:416) at com.sun.enterprise.resource.IASNonSharedResourcePool.internalGetResource(IASNonSharedResourcePool.java:625) at com.sun.enterprise.resource.IASNonSharedResourcePool.getResource(IASNonSharedResourcePool.java:520) at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:263) at com.sun.enterprise.resource.SystemJdbcDataSource.internalGetConnection(SystemJdbcDataSource.java:226) at com.sun.enterprise.resource.SystemJdbcDataSource.getConnection(SystemJdbcDataSource.java:154) at com.sun.jdo.spi.persistence.support.sqlstore.ejb.TransactionHelperImpl.getConnection(TransactionHelperImpl.java:171) at com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getConnection(EJBHelper.java:169) at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getDBName(SQLPersistenceManagerFactory.java:781) at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getFromPool(SQLPersistenceManagerFactory.java:709) at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getPersistenceManager(SQLPersistenceManagerFactory.java:598) at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:770) at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:660) at com.dalcais.domain.TownBean809727498_ConcreteImpl.jdoGetPersistenceManager(TownBean809727498_ConcreteImpl.java:825) at com.dalcais.domain.TownBean809727498_ConcreteImpl.ejbFindAll(TownBean809727498_ConcreteImpl.java:411) at com.dalcais.domain.TownBean809727498_ConcreteImpl_LocalHomeImpl.findAll(TownBean809727498_ConcreteImpl_LocalHomeImpl.java:100) at com.dalcais.apps.re.ListingSessionBean.getAllTowns(ListingSessionBean.java:134) at com.dalcais.apps.re.ListingSessionBean_EJBObjectImpl.getAllTowns(ListingSessionBean_EJBObjectImpl.java:22) at com.dalcais.apps.re._ListingSessionBean_EJBObjectImpl_Tie._invoke(Unknown Source) at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:569) at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:211) at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:113) at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:275)
    No Bugmate found.