Re: JDBC java.net.BindException connecting to Postgres 7.4 running on Cygwin Win2K

Lists: pgsql-cygwinpgsql-jdbc
From: Matt Magoffin <matt(at)msqr(dot)us>
To: pgsql-jdbc(at)postgresql(dot)org, pgsql-cygwin(at)postgresql(dot)org
Subject: JDBC java.net.BindException connecting to Postgres 7.4 running on Cygwin Win2K
Date: 2003-12-24 23:32:29
Message-ID: 3FEA220D.1050608@msqr.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-jdbc

I'm getting the exception below when I try to connect to my locally
running instance of Postgres 7.4 (via Cygwin on Win2K). I'm trying to
connect via a DataSource configured with Tomcat 4.1.24. I can connect to
instances of Postgres this way on other machines, just not my locally
running instance. I can connect to the local instance just fine using
psql (with or without using TCP/IP via '-h 127.0.0.1') and applications
like pgAdmin are able to connect to it as well. This looks like the same
error noted in

http://archives.postgresql.org/pgsql-jdbc/2003-07/msg00058.php

but I didn't find any followups that addressed the problem for me (this
error happens every time I try to get a connection, including the first
attempt when there are no active connections to the database).

Has anyone been able to find a solution to this error?

Thanks in advance,
Matt

java.net.BindException: Address already in use: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:426)
at java.net.Socket.connect(Socket.java:376)
at java.net.Socket.<init>(Socket.java:291)
at java.net.Socket.<init>(Socket.java:119)
at org.postgresql.core.PGStream.<init>(PGStream.java:47)
at
org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:197)
at org.postgresql.Driver.connect(Driver.java:139)
at
org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:83)
at
org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:184)
at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source)
at
org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:117)
at
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110)
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
[snip]


From: Matt Magoffin <matt(at)msqr(dot)us>
To:
Cc: pgsql-jdbc(at)postgresql(dot)org, pgsql-cygwin(at)postgresql(dot)org
Subject: Re: [JDBC] JDBC java.net.BindException connecting to Postgres 7.4
Date: 2003-12-25 01:14:30
Message-ID: 3FEA39F6.8090602@msqr.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-jdbc

One other piece of the puzzle is that when I don't connect via the
Tomcat DataSource, i.e. I use the DriverManager, the connection works!

-- m@

Matt Magoffin wrote:

> java.net.BindException: Address already in use: connect
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
> at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
> at java.net.Socket.connect(Socket.java:426)
> at java.net.Socket.connect(Socket.java:376)
> at java.net.Socket.<init>(Socket.java:291)
> at java.net.Socket.<init>(Socket.java:119)
> at org.postgresql.core.PGStream.<init>(PGStream.java:47)
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:197)
>
> at org.postgresql.Driver.connect(Driver.java:139)
> at
> org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:83)
>
> at
> org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:184)
>
> at
> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown
> Source)
> at
> org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:117)
>
> at
> org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110)
>
> at
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
>
> [snip]


From: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
To: Matt Magoffin <matt(at)msqr(dot)us>
Cc: "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC java.net.BindException connecting to Postgres 7.4 running on Cygwin Win2K
Date: 2003-12-25 10:37:24
Message-ID: 20031225103724.A3201@bacon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-jdbc


On 24/12/2003 23:32 Matt Magoffin wrote:
> I'm getting the exception below when I try to connect to my locally
> running instance of Postgres 7.4 (via Cygwin on Win2K). I'm trying to
> connect via a DataSource configured with Tomcat 4.1.24. I can connect to
> instances of Postgres this way on other machines, just not my locally
> running instance. I can connect to the local instance just fine using
> psql (with or without using TCP/IP via '-h 127.0.0.1') and applications
> like pgAdmin are able to connect to it as well. This looks like the same
> error noted in
>
> http://archives.postgresql.org/pgsql-jdbc/2003-07/msg00058.php
>
> but I didn't find any followups that addressed the problem for me (this
> error happens every time I try to get a connection, including the first
> attempt when there are no active connections to the database).
>
> Has anyone been able to find a solution to this error?
>
> Thanks in advance,
> Matt
>
> java.net.BindException: Address already in use: connect

Its a Windows thing. I suggest following the links provided in the posting.

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+