Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id CBE5213C699A for ; Fri, 4 May 2012 15:30:41 -0300 (ADT) Received: from mail209.messagelabs.com ([216.82.255.3]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SQNH4-0003G7-7f for pgsql-jdbc@postgresql.org; Fri, 04 May 2012 18:30:40 +0000 X-Env-Sender: skong@investoranalytics.com X-Msg-Ref: server-7.tower-209.messagelabs.com!1336156219!4801073!2 X-Originating-IP: [216.166.12.31] X-StarScan-Version: 6.5.7; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16621 invoked from network); 4 May 2012 18:30:23 -0000 Received: from out001.collaborationhost.net (HELO out001.collaborationhost.net) (216.166.12.31) by server-7.tower-209.messagelabs.com with RC4-SHA encrypted SMTP; 4 May 2012 18:30:23 -0000 Received: from AUSP01VMBX04.collaborationhost.net ([10.2.8.80]) by AUSP01MHUB01.collaborationhost.net ([10.2.8.25]) with mapi; Fri, 4 May 2012 13:30:19 -0500 From: Shijun Kong To: Dave Cramer CC: "pgsql-jdbc@postgresql.org" Date: Fri, 4 May 2012 13:30:17 -0500 Subject: Re: PGSimpleDataSource not support jdbc url Thread-Topic: [JDBC] PGSimpleDataSource not support jdbc url Thread-Index: Ac0qI/U0DEyhUX32QPaE0Pn1IU5hKg== Message-ID: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.2.1.120420 acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Pg-Spam-Score: -4.2 (----) X-Archive-Number: 201205/10 X-Sequence-Number: 22910 Hi Dave,=20 I didn't say it is a part of JDBC API, if you look DataSource interface, it has nothing about database server, port, username or password. Not any of them.=20 It is just a minor feature which I think is handy to have. And I am asking here if anyone aware of any future plan of this part, because I did not find a feature requesting / bug tracking page here: http://jdbc.postgresql.org/ On 5/4/12 2:19 PM, "Dave Cramer" wrote: >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 >wrote: >> When go DriverManager approach, we can do something like: >> (http://jdbc.postgresql.org/documentation/80/connect.html) >> >> String url =3D >> "jdbc:postgresql://localhost/test?user=3Dfred&password=3Dsecret&ssl=3Dtr= ue"; >> Connection conn =3D 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" 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 >>> >>>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.Kong@investoranalytics.com >>>> www.investoranalytics.com >>>> >>>> www.riskology.com >>