From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
To: | Shijun Kong <skong(at)investoranalytics(dot)com> |
Cc: | "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: PGSimpleDataSource not support jdbc url |
Date: | 2012-05-04 18:19:59 |
Message-ID: | CADK3HHJxfz3BxJhhNSVgz2V6W+56q1B3JZqcANbyOWBMMrH9bg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Shijun,
Well the JDBC API does not support getting a DataSource via a URL.
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On Fri, May 4, 2012 at 1:59 PM, Shijun Kong <skong(at)investoranalytics(dot)com> wrote:
> When go DriverManager approach, we can do something like:
> (http://jdbc.postgresql.org/documentation/80/connect.html)
>
> String url =
> "jdbc:postgresql://localhost/test?user=fred&password=secret&ssl=true";
> Connection conn = DriverManager.getConnection(url);
>
>
>
> However, if you want to use javax.sql.DataSource approach instead of
> DriverManager, the current implementation in PGSimpleDataSource(I am using
> 8.4, looks like 9.x has the same API) force you providing serverName,
> PortNumber, databaseName, user, password one by one via setter methods.
> Sure, you can parse a jdbc url to get all these properties and set them
> one by one. But prefer a jdbc driver library can do that for end-users
> which could save boilerplate code for everyone.
>
>
>
> On 5/4/12 1:52 PM, "Dave Cramer" <pg(at)fastcrypt(dot)com> wrote:
>
>>Shijun,
>>
>>Can you be more specific ?
>>
>>Dave Cramer
>>
>>dave.cramer(at)credativ(dot)ca
>>http://www.credativ.ca
>>
>>
>>On Fri, May 4, 2012 at 1:46 PM, Shijun Kong <skong(at)investoranalytics(dot)com>
>>wrote:
>>> Hi,
>>>
>>> I am new to postgreSQL, pgsql-jdbc. If I am not mistaken,
>>>PGSimpleDataSource
>>> does not support jdbc url. Is there any plan to implement it in future?
>>>
>>> __________________________
>>> Shijun Kong, Software Developer
>>> Investor Analytics - Risk Transparency
>>>
>>> Direct: +1 646.553.4510 x 121
>>> Shijun(dot)Kong(at)investoranalytics(dot)com
>>> www.investoranalytics.com
>>>
>>> www.riskology.com
>
From | Date | Subject | |
---|---|---|---|
Next Message | Shijun Kong | 2012-05-04 18:30:17 | Re: PGSimpleDataSource not support jdbc url |
Previous Message | Shijun Kong | 2012-05-04 17:59:58 | Re: PGSimpleDataSource not support jdbc url |