Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id CDE8D1337D63 for ; Fri, 1 Apr 2011 11:37:28 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 54561-01-9 for ; Fri, 1 Apr 2011 14:37:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by mail.postgresql.org (Postfix) with ESMTP id 7028F1337FCD for ; Fri, 1 Apr 2011 11:14:14 -0300 (ADT) Received: from [192.168.7.181] (cpe-24-24-224-57.socal.res.rr.com [24.24.224.57]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail63.csoft.net (Postfix) with ESMTPSA id C098C28458; Fri, 1 Apr 2011 10:14:13 -0400 (EDT) Message-ID: <4D95DDB8.2080809@ejurka.com> Date: Fri, 01 Apr 2011 07:14:16 -0700 From: Kris Jurka User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: DI Martin Handsteiner CC: pgsql-bugs@postgresql.org Subject: Re: BUG #5961: JDBC Driver acceptURL does not check 'jdbc:postgresql:' References: <201103311309.p2VD9E8o097110@wwwmaster.postgresql.org> <002d01cbefbb$4c6f8190$e54e84b0$@handsteiner@sibvisions.com> <4D94D9E7.6080807@ejurka.com> <000001cbf047$b05e1090$111a31b0$@handsteiner@sibvisions.com> In-Reply-To: <000001cbf047$b05e1090$111a31b0$@handsteiner@sibvisions.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201104/5 X-Sequence-Number: 29924 On 4/1/2011 1:34 AM, DI Martin Handsteiner wrote: > > Here a working test case: > > Properties properties = new Properties(); > properties.setProperty("user", "sa"); > properties.setProperty("password", ""); > properties.put("shutdown", Boolean.TRUE); > > Connection hsqlConnection = > DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/testdb", > properties); > > > The method acceptsUrl should not only check, if it finds some suitable > properties, > It should also check, if the url is ment for postgresql. > In my opinion it should look like: > It turns out that DriverManager.getConnection does not call acceptsUrl at all. It just tries to connect with each registered driver in turn. Apparently acceptsUrl is only used for DriverManager.getDriver. So changing acceptsUrl (which I maintain works just fine) won't help anything. What's happening here is that the DriverManager tries to use the postgresql Driver to establish a connection to the given URL, but it ends up choking on the provided Properties before it can bail out because it is not the correct URL. You should not use the Hashtable inherited Properties.put method to insert non-string data into a properties object because all keys and values should be Strings. If you get rid of properties.put("shutdown", Boolean.TRUE), it works just fine. Kris Jurka