Thread: socket problem
> I just downloaded postgres and the jdbc driver, have both installed, but
> when I try to connect via remote host I get this error:
>
> The connection attempt failed because Exception:
> java.net.SocketException: Connection reset by peer: connect
> Stack Trace:
> java.net.SocketException: Connection reset by peer: 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.PG_Stream.<init>(PG_Stream.java:38)
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:160)
> at org.postgresql.Driver.connect(Driver.java:122)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:193)
> at optdata.zbeans.ZServerJdbc.createConnection(ZServerJdbc.java:85)
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:29)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> End of Stack Trace
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:171)
> at org.postgresql.Driver.connect(Driver.java:122)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:193)
> at optdata.zbeans.ZServerJdbc.createConnection(ZServerJdbc.java:85)
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:29)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> java.lang.NullPointerException
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:30)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> My connection string looks like this:
> jdbc:postgresql://190.85.90.37/test?user=BrianH
> postmaster started with -i
> Anybody seen anything like this before??Please help.
> when I try to connect via remote host I get this error:
>
> The connection attempt failed because Exception:
> java.net.SocketException: Connection reset by peer: connect
> Stack Trace:
> java.net.SocketException: Connection reset by peer: 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.PG_Stream.<init>(PG_Stream.java:38)
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:160)
> at org.postgresql.Driver.connect(Driver.java:122)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:193)
> at optdata.zbeans.ZServerJdbc.createConnection(ZServerJdbc.java:85)
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:29)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> End of Stack Trace
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:171)
> at org.postgresql.Driver.connect(Driver.java:122)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:193)
> at optdata.zbeans.ZServerJdbc.createConnection(ZServerJdbc.java:85)
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:29)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> java.lang.NullPointerException
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:30)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> My connection string looks like this:
> jdbc:postgresql://190.85.90.37/test?user=BrianH
> postmaster started with -i
> Anybody seen anything like this before??Please help.
Brian:
Can you connect using psql? Also, make sure you are using the default port where postgres is running - as I can see by your URI that you are using the default port. One other thing, you could try netstat on the machine where postgres is running to make sure it is listening on the port you assume it is.
Scot
Brian Harris wrote:
Can you connect using psql? Also, make sure you are using the default port where postgres is running - as I can see by your URI that you are using the default port. One other thing, you could try netstat on the machine where postgres is running to make sure it is listening on the port you assume it is.
Scot
Brian Harris wrote:
> I just downloaded postgres and the jdbc driver, have both installed, but
> when I try to connect via remote host I get this error:
>
> The connection attempt failed because Exception:
> java.net.SocketException: Connection reset by peer: connect
> Stack Trace:
> java.net.SocketException: Connection reset by peer: 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.PG_Stream.<init>(PG_Stream.java:38)
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:160)
> at org.postgresql.Driver.connect(Driver.java:122)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:193)
> at optdata.zbeans.ZServerJdbc.createConnection(ZServerJdbc.java:85)
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:29)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> End of Stack Trace
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:171)
> at org.postgresql.Driver.connect(Driver.java:122)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:193)
> at optdata.zbeans.ZServerJdbc.createConnection(ZServerJdbc.java:85)
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:29)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> java.lang.NullPointerException
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:30)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> My connection string looks like this:
> jdbc:postgresql://190.85.90.37/test?user=BrianH
> postmaster started with -i
> Anybody seen anything like this before??Please help.
-- Scot P. Floess - 27 Lake Royale - Louisburg, NC 27549 - 252-478-8087 Open Source Home Page -------------------------------------- http://javapim.sourceforge.net http://jplate.sourceforge.net http://jwaretechniques.sourceforge.net Open Source Project Host ----------------------------------------------- http://sourceforge.net/projects/javapim http://sourceforge.net/projects/jplate http://sourceforge.net/projects/jwaretechniques
Scot P. Floess wrote: > Brian: > > Can you connect using psql? Also, make sure you are using the default > port where postgres is running - as I can see by your URI that you are > using the default port. One other thing, you could try netstat on the > machine where postgres is running to make sure it is listening on the > port you assume it is. If you CAN connect through psql, you might have a look at PG_HBA.CONF which contains the authentication settings for postgres. Another thing to try is not to supply the username in the url, but to use DriverManager.getConnection(url, username, password) instead. Regards, Per-Olof Norén Curalia AB > > Scot > > Brian Harris wrote: > >> > I just downloaded postgres and the jdbc driver, have both >> installed, but >> > when I try to connect via remote host I get this error: >> > >> > The connection attempt failed because Exception: >> > java.net.SocketException: Connection reset by peer: connect >> > Stack Trace: >> > java.net.SocketException: Connection reset by peer: 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.PG_Stream.<init>(PG_Stream.java:38) >> > at >> > >> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:160) >> > at org.postgresql.Driver.connect(Driver.java:122) >> > at java.sql.DriverManager.getConnection(DriverManager.java:512) >> > at java.sql.DriverManager.getConnection(DriverManager.java:193) >> > at >> optdata.zbeans.ZServerJdbc.createConnection(ZServerJdbc.java:85) >> > at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:29) >> > at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161) >> > End of Stack Trace >> > at >> > >> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:171) >> > at org.postgresql.Driver.connect(Driver.java:122) >> > at java.sql.DriverManager.getConnection(DriverManager.java:512) >> > at java.sql.DriverManager.getConnection(DriverManager.java:193) >> > at >> optdata.zbeans.ZServerJdbc.createConnection(ZServerJdbc.java:85) >> > at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:29) >> > at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161) >> > java.lang.NullPointerException >> > at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:30) >> > at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161) >> > My connection string looks like this: >> > jdbc:postgresql://190.85.90.37/test?user=BrianH >> > postmaster started with -i >> > Anybody seen anything like this before??Please help. >> Brian Harris >> Optdata Inc/ATRS >> brian.harris@optdatainc.com <mailto:brian.harris@optdatainc.com> > > >-- >Scot P. Floess - 27 Lake Royale - Louisburg, NC 27549 - 252-478-8087 > >Open Source Home Page >-------------------------------------- >http://javapim.sourceforge.net >http://jplate.sourceforge.net >http://jwaretechniques.sourceforge.net > >Open Source Project Host >----------------------------------------------- >http://sourceforge.net/projects/javapim >http://sourceforge.net/projects/jplate >http://sourceforge.net/projects/jwaretechniques > > >
Brian:
You have to make sure postgres will accept sockets. You can do this either by enabling in postgresql.conf (set tcpip_socket = true) or when you start postgress in your /etc/rc.d/init.d/postgres shell script.
Scot
PS: when you enable the socket setting, make sure you start/stop postgres...
Brian Harris wrote:
You have to make sure postgres will accept sockets. You can do this either by enabling in postgresql.conf (set tcpip_socket = true) or when you start postgress in your /etc/rc.d/init.d/postgres shell script.
Scot
PS: when you enable the socket setting, make sure you start/stop postgres...
Brian Harris wrote:
I can connect with psql and do anything I want locally. I ran netstat, but didn't see anything matching 5432. Would there be any reason it wouldn't be running on 5432? I am running redhat 7.3 advanced server.
----- Original Message -----From: Scot P. FloessTo: Brian HarrisSent: Monday, March 10, 2003 10:10 AMSubject: Re: [JDBC] socket problemBrian:
Can you connect using psql? Also, make sure you are using the default port where postgres is running - as I can see by your URI that you are using the default port. One other thing, you could try netstat on the machine where postgres is running to make sure it is listening on the port you assume it is.
Scot
Brian Harris wrote: > I just downloaded postgres and the jdbc driver, have both installed, but
> when I try to connect via remote host I get this error:
>
> The connection attempt failed because Exception:
> java.net.SocketException: Connection reset by peer: connect
> Stack Trace:
> java.net.SocketException: Connection reset by peer: 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.PG_Stream.<init>(PG_Stream.java:38)
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:160)
> at org.postgresql.Driver.connect(Driver.java:122)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:193)
> at optdata.zbeans.ZServerJdbc.createConnection(ZServerJdbc.java:85)
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:29)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> End of Stack Trace
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:171)
> at org.postgresql.Driver.connect(Driver.java:122)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:193)
> at optdata.zbeans.ZServerJdbc.createConnection(ZServerJdbc.java:85)
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:29)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> java.lang.NullPointerException
> at atrs.utility.dbclean.CvtReti.<init>(CvtReti.java:30)
> at atrs.utility.dbclean.CvtReti.main(CvtReti.java:161)
> My connection string looks like this:
> jdbc:postgresql://190.85.90.37/test?user=BrianH
> postmaster started with -i
> Anybody seen anything like this before??Please help.-- Scot P. Floess - 27 Lake Royale - Louisburg, NC 27549 - 252-478-8087 Open Source Home Page -------------------------------------- http://javapim.sourceforge.net http://jplate.sourceforge.net http://jwaretechniques.sourceforge.net Open Source Project Host ----------------------------------------------- http://sourceforge.net/projects/javapim http://sourceforge.net/projects/jplate http://sourceforge.net/projects/jwaretechniques
-- Scot P. Floess - 27 Lake Royale - Louisburg, NC 27549 - 252-478-8087 Open Source Home Page -------------------------------------- http://javapim.sourceforge.net http://jplate.sourceforge.net http://jwaretechniques.sourceforge.net Open Source Project Host ----------------------------------------------- http://sourceforge.net/projects/javapim http://sourceforge.net/projects/jplate http://sourceforge.net/projects/jwaretechniques