pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Connection problems
3+ messages / 3 participants
[nested] [flat]

* Connection problems
@ 2002-04-28 14:44 PaulU71555@aol.com
  0 siblings, 0 replies; 3+ messages in thread

From: PaulU71555@aol.com @ 2002-04-28 14:44 UTC (permalink / raw)
  To: pgsql-jdbc

Hi.  I've been here before, with a similar problem...

My setup:

I'm using Red Hat 7.2...
Postmaster started by user Postgres with -i option (in /etc/rc.d/rc.local: su 
-c 'nohup /usr/bin/postmaster -i -D /usr/local/pgsql/data >
/var/log/postmaster 2>&1 &" postgres)...
I've tried with pgjdbc1.jar in CLASSPATH and with pgjdbc2.jar in CLASSPATH...
I compile with javac -target 1.1...
I'm using j2sdk1.4.0...
I'm running as Paul (i.e. not as root or Postgres)...
"Paul" is a legit. database which Paul owns...
Browser is Netscape Version 4.78...

I use this code (non-critical functions deleted for simplicity's sake):

//BEGIN CODE SNIPPET

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.URL;
import java.sql.*;

public class PWEntry extends Applet implements ActionListener{
    private Connection db;
    private String url;
    private Button doItButton;
    private Button cancelButton;
    private Button resetButton;
    private TextField userIDField;
    private TextField passwordField;
    private TextField passwordCheckField;

    private Color bg = Color.gray;
    private Color textbg = Color.white;

    public void init(){
    url = "jdbc:postgresql:Paul";
    if(!(databaseSetup())){
        return;
    }
    
    makeLayout();
    }

    public void makeLayout(){
    //Code removed for brevity
    }

    public boolean databaseSetup(){
    System.out.println("databaseSetup");
    try{
        Driver driver = 
(Driver)Class.forName("org.postgresql.Driver").newInstance();
        DriverManager.registerDriver(driver);
    }
    catch(Exception e){
        System.err.println("Exception: " + e.toString());
        return false;
    }
    System.out.println("databaseSetup successful");
    return true;
    }

    public boolean databaseConnect(){
    System.out.println("databaseConnect");
    try{
        db = DriverManager.getConnection(url, "Paul", "");
    }
    catch (SQLException e){
        System.out.println("SQL Exception...");
        System.out.println(e.getMessage());
        System.out.println("...gonna give up.");
        return false;
    }
    System.out.println("databaseConnect successful");
    return true;
    }

    public void start(){
    System.out.println("start");
    if(!(databaseConnect())){
        return;
    }
    }

    public void stop(){
    System.out.println("stop");
    try{
        db.close();
    }
    catch(SQLException e){
    }
    }

    public void actionPerformed(ActionEvent evt){
    //Code removed for brevity
    }

    public boolean insertUser(){
    //Code removed for brevity
    }

    public boolean validateInput(String uid, String pwd, String pwdChk){
    //Code removed for brevity
    }

    public void reportError(String error){
    //Code removed for brevity
    }

    //end of class
}

//END CODE SNIPPET

I get the following result when opening an html file which contains the above 
applet code:

//JAVA CONSOLE OUTPUT BEGINS

databaseSetup
databaseSetup successful
start
databaseConnect

SQL Exception...
Something unusual has occured to cause the driver to fail.  Please report 
this exception: Exception: java.lang.IllegalArgumentException: 
sun.io.CharToByteus-ascii
Stack Trace:

java.lang.IllegalArgumentException: sun.io.ChartToByteus-ascii
    at sun.io.CharToByteConverter.getConverter(CharToByteConverter.java:99)
    at java.lang.String.getBytes(String.java:544)
    at org.postgresql.core.Encoding.isAvailable(Encoding.java:212)
    at 
org.postgresql.core.Encoding.encodingForDatabaseEncoding(Encoding.java:106)
*   at org.postgresql.core.Encoding.getEncoding(Encoding.java:88)
    at org.postgresql.Connection.openConnection(Connection.java:324)
    at org.postgresql.Driver.connect(Driver.java:149)
    at java.sql.DriverManager.getConnection(DriverManager.java:90)
    at java.sql.DriverManager.getConnection(DriverManager.java:132)
    at PWEntry.databaseConnect(PWEntry.java:107)
    at PWEntry.start(PWEntry.java:121)
    at 
netscape.applet.DerivedAppletFrame$StartAppletEvent.dispatch(DerivedAppletFram

e.java:640)
    at 
java.awt.EventDispatchThread$EventPump.dispatchEvents(EventDispatchThread.java

:81)
    at java.awt.EventDispatchThread.run(EventDispatchThread.jav:135)
    at 
netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(DerivedApplet

Frame.java:911)
End of Stack Trace

...gonna give up

//JAVA CONSOLE OUTPUT ENDS

Note that this code worked under Red Hat 6.1/Postgresql 7.2/pgjdbc1.jar.  I 
upgraded to RedHat 7.2, so my suspicion is that I fooed some setup parameter 
along the way, but which/what/where?  Any help would be gratefully accepted.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Connection Problems
@ 2004-12-29 20:48 mmckenzie@unmc.edu
  2004-12-29 23:34 ` Re: Connection Problems Dave Cramer <pg@fastcrypt.com>
  0 siblings, 1 reply; 3+ messages in thread

From: mmckenzie@unmc.edu @ 2004-12-29 20:48 UTC (permalink / raw)
  To: pgsql-jdbc

Hello All,

I'm using 74.214 of the JDBC driver on a cold fusion datasource and 
periodically I receive the following error:

Error Executing Database Query. An I/O error occured while reading from 
backend - Exception: java.net.SocketException: Connection reset Stack 
Trace: java.net.SocketException: Connection reset at 
java.net.SocketInputStream.read(SocketInputStream.java:168) at 
java.io.BufferedInputStream.fill(BufferedInputStream.java:183) at 
java.io.BufferedInputStream.read(BufferedInputStream.java:201) at 
org.postgresql.core.PGStream.ReceiveChar(PGStream.java:166) at 
org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:127) at 
org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:100) at 
org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43) at 
org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:517) 
at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50) 
at 
org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:298) 
at 
coldfusion.server.j2ee.sql.JRunStatement.execute(JRunStatement.java:212) 
at coldfusion.sql.Executive.execu... 
The error occurred on line 1.


It appears that the connection is timing out.

What causes this?

Mitchell S. McKenzie
Programmer
Learning Environment & Internet Services
University of Nebraska Medical Center
Phone: 402-559-9306
Cell Phone: 402-708-1493

University of Nebraska Medical Center E-mail Confidentiality Disclaimer :
The information in this e-mail is privileged and confidential, intended 
only for the use of the addressee(s) above.
Any unauthorized use or disclosure of this information is prohibited. 
If you have received this e-mail by mistake please delete it and 
immediately contact the sender. 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Connection Problems
  2004-12-29 20:48 Connection Problems mmckenzie@unmc.edu
@ 2004-12-29 23:34 ` Dave Cramer <pg@fastcrypt.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Dave Cramer @ 2004-12-29 23:34 UTC (permalink / raw)
  To: mmckenzie@unmc.edu; +Cc: pgsql-jdbc

9 times out of 10 this is caused by a firewall.

Dave

mmckenzie@unmc.edu wrote:

>
> Hello All,
>
> I'm using 74.214 of the JDBC driver on a cold fusion datasource and 
> periodically I receive the following error:
>
> Error Executing Database Query. An I/O error occured while reading 
> from backend - Exception: java.net.SocketException: Connection reset 
> Stack Trace: java.net.SocketException: Connection reset at 
> java.net.SocketInputStream.read(SocketInputStream.java:168) at 
> java.io.BufferedInputStream.fill(BufferedInputStream.java:183) at 
> java.io.BufferedInputStream.read(BufferedInputStream.java:201) at 
> org.postgresql.core.PGStream.ReceiveChar(PGStream.java:166) at 
> org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:127) at 
> org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:100) at 
> org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43) at 
> org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:517) 
> at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50) 
> at 
> org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:298) 
> at 
> coldfusion.server.j2ee.sql.JRunStatement.execute(JRunStatement.java:212) 
> at coldfusion.sql.Executive.execu...
> The error occurred on line 1.
>
>
> It appears that the connection is timing out.
>
> What causes this?
>
> Mitchell S. McKenzie
> Programmer_
> __Learning Environment & Internet Services_ <http://app1.unmc.edu/leis;
> University of Nebraska Medical Center
> Phone: 402-559-9306
> Cell Phone: 402-708-1493
> *
> University of Nebraska Medical Center E-mail Confidentiality Disclaimer :*
> The information in this e-mail is privileged and confidential, 
> intended only for the use of the addressee(s) above.
> Any unauthorized use or disclosure of this information is prohibited.
> If you have received this e-mail by mistake please delete it and 
> immediately contact the sender. 


-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-12-29 23:34 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-28 14:44 Connection problems PaulU71555@aol.com
2004-12-29 20:48 Connection Problems mmckenzie@unmc.edu
2004-12-29 23:34 ` Re: Connection Problems Dave Cramer <pg@fastcrypt.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox