From 6767345064cec20bb9382ca7370ac38f625b9f04 Mon Sep 17 00:00:00 2001 From: mdb Date: Sat, 10 Nov 2001 04:42:24 +0000 Subject: [PATCH] If the connection chokes while we're opening it, we need to let the connection provider know that it's no longer any good. git-svn-id: https://samskivert.googlecode.com/svn/trunk@450 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/jdbc/SimpleRepository.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/samskivert/src/java/com/samskivert/jdbc/SimpleRepository.java b/projects/samskivert/src/java/com/samskivert/jdbc/SimpleRepository.java index 0ec8238c..b94078d3 100644 --- a/projects/samskivert/src/java/com/samskivert/jdbc/SimpleRepository.java +++ b/projects/samskivert/src/java/com/samskivert/jdbc/SimpleRepository.java @@ -1,5 +1,5 @@ // -// $Id: SimpleRepository.java,v 1.3 2001/09/21 03:01:46 mdb Exp $ +// $Id: SimpleRepository.java,v 1.4 2001/11/10 04:42:24 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -89,8 +89,15 @@ public class SimpleRepository extends Repository dmd = conn.getMetaData(); liaison = LiaisonRegistry.getLiaison(conn); gotConnection(conn); + } catch (SQLException sqe) { String err = "Unable to obtain connection."; + // if the connection was created, let the provider know that + // it choked + if (conn != null) { + _provider.connectionFailed(_dbident, conn, sqe); + } + // and then do a little choking ourselves throw new PersistenceException(err, sqe); }