From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | DI Martin Handsteiner <martin(dot)handsteiner(at)sibvisions(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #5961: JDBC Driver acceptURL does not check 'jdbc:postgresql:' |
Date: | 2011-04-01 14:14:16 |
Message-ID: | 4D95DDB8.2080809@ejurka.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2011-04-01 14:37:59 | Re: Postgres not using indexes |
Previous Message | Sumit | 2011-04-01 10:04:49 | BUG #5962: Problem Acessing Network Path |