DataSource.setMaxConnections() - Does not work

View: New views
4 Messages — Rating Filter:   Alert me  

DataSource.setMaxConnections() - Does not work

by Michael Andreasen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Using version: 8.3-605.jdbc3

DataSource.setMaxConnections() does not work.

I create my datasource as such;
dataSource = new PGPoolingDataSource();
        dataSource.setServerName("10.44.73.50");
        dataSource.setDatabaseName("ops");
        dataSource.setUser("postgres");
        dataSource.setPassword("postgres");
        dataSource.setMaxConnections(3);

--
Regards,
Michael Andreasen
Senior Analyst / Developer

Re: DataSource.setMaxConnections() - Does not work

by Michael Andreasen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Even though I set it at 3, if I look on the server I can see many more connections have been made?


On Sat, Sep 26, 2009 at 2:25 PM, Michael Andreasen <michael@...> wrote:
Hi,

Using version: 8.3-605.jdbc3

DataSource.setMaxConnections() does not work.

I create my datasource as such;
dataSource = new PGPoolingDataSource();
        dataSource.setServerName("10.44.73.50");
        dataSource.setDatabaseName("ops");
        dataSource.setUser("postgres");
        dataSource.setPassword("postgres");
        dataSource.setMaxConnections(3);

--
Regards,
Michael Andreasen
Senior Analyst / Developer



--
Regards,
Michael Andreasen
Senior Analyst / Developer

Re: DataSource.setMaxConnections() - Does not work

by Kris Jurka :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Sat, 26 Sep 2009, Michael Andreasen wrote:

> Even though I set it at 3, if I look on the server I can see many more
> connections have been made?

The three connection limit is the most the datasource will open for you,
but it cannot prevent other people/processes from opening other
connections to the server.  If you really believe all of these are being
opened by the datasource, perhaps you really have many instances of the
datasource, each of which will open up to three connections.

Kris Jurka

--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

Parent Message unknown Re: DataSource.setMaxConnections() - Does not work

by J. W. Ulbts :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Michael,

I'm sure your assumption is not correct.
The application uses the maximum of 3 connections but every other application also accessing PostgreSQL needs at least one connection (e.g. pgAdmin,...), so you see >3 connections to the server.
It's also possible that there is an error in the code so not only the datasource you defined is used.
You might want to replace the driver with 8.4 Build 701. I'm using that driver myself with a max connection setting.

Testing it is very easy...just try to open more connections then possible. You will see that the application "hangs" if you try to open connection number 4.

--
Kind regards,
Juergen Ulbts


> -----Ursprüngliche Nachricht-----
> Von: "Michael Andreasen" <michael@...>
> Gesendet: 26.09.09 15:35:28
> An: pgsql-jdbc@...
> Betreff: Re: [JDBC] DataSource.setMaxConnections() - Does not work

Even though I set it at 3, if I look on the server I can see many

> more connections have been made?
>
> On Sat, Sep 26, 2009 at 2:25 PM, Michael Andreasen <michael@dunlops.
> com> wrote:
> Hi,
>
> Using version: 8.3-605.jdbc3
>
> DataSource.setMaxConnections() does not work.
>
> I create my datasource as such;
> dataSource = new PGPoolingDataSource();
>  dataSource.setServerName("10.44.73.50");
>  dataSource.setDatabaseName("ops");
>  dataSource.setUser("postgres");
>  dataSource.setPassword("postgres");
>  dataSource.setMaxConnections(3);
>
> --
> Regards,
> Michael Andreasen
> Senior Analyst / Developer
>
> --
> Regards,
> Michael Andreasen
> Senior Analyst / Developer
>
>


________________________________________________________________
Neu: WEB.DE Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://produkte.web.de/go/02/


--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc