Albert Kam wrote:
Dear all ..

Ah, finally, a solution that works !

[ snip ]


and use it in the source code like this :
    public void shutdownDB() {
        Context initCtx;
        try {
            log.debug("shutting down database from datasource");
            initCtx = new InitialContext();
            Context envCtx = (Context) initCtx.lookup("java:comp/env");
            ds = (DataSource) envCtx.lookup("jdbc/SofcoSMSShutdown");
            ds.getConnection();
            ds = null;
            log.debug("database shutdown complete");
        } catch (NamingException e) {
            log.error(e,e);
            throw new InfrastructureException(e);
        } catch (SQLException e) {
            log.error(e,e);
            throw new InfrastructureException(e);
        }
   }


What does this piece of code log?
The getConnection-call is supposed to thrown an exception, also when the shutdown is successful. If successful, e.getSQLState() returns "08006".


--
Kristian

[ snip ]

Reply via email to