pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mutua K <mutuah@hotmail.co.uk>
To: pgsql-admin@postgresql.org
Subject: Re: An I/O error occured while sending to the backend
Date: Wed, 27 Jun 2007 02:20:09 +0100
Message-ID: <BAY127-F3055D5C84D3E43DEE460F8820A0@phx.gbl> (raw)
In-Reply-To: <20070627005819.0D8FE8B2A1F@mx2.hub.org>

Any help?

Am reading a couple of values from a txt file and store them in a table. The 
first line of the txt file is read well and saved. When the program reads 
the second line, it displays the errors listed down.

Here is a method am using:

    public boolean addUser(
            String ID,
            String Password,
            String lastName,
            String firstName)
            throws SQLException, ClassNotFoundException, IOException {
        conn = Connect.getConnection();
        while (in.ready()) {
            String line = in.readLine();
            st = new StringTokenizer(line);
            while (st.hasMoreTokens()){
                myID = st.nextToken();
                myPassword = st.nextToken();
                mylastName = st.nextToken();
                myfirstName = st.nextToken();

                ID = myID;
                Password = myPassword;
                lastName = mylastName;
                firstName = myfirstName;

                String sql = "INSERT INTO supervisor " +
                        "(superv_id, superv_pass, superv_lastname, 
superv_firstname)" +
                        "VALUES (?,?,?,?)";
                prep = conn.prepareStatement(sql);
                prep.setString(1, ID);
                prep.setString(2, Password);
                prep.setString(3, lastName);
                prep.setString(4, firstName);
                prep.executeUpdate();
                conn.close();
            }
        }
        return true;
    }


Error:

Exception in thread "main" org.postgresql.util.PSQLException: An I/O error 
occured while sending to the backend.
Exception: java.io.IOException: Stream closed
Stack Trace:
java.io.IOException: Stream closed
        at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder.java:38)
        at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:151)
        at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
        at org.postgresql.core.PGStream.flush(PGStream.java:507)
        at 
org.postgresql.core.v3.QueryExecutorImpl.sendSync(QueryExecutorImpl.java:675)
        at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:190)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:305)
        at prototype.PopulatingDB.addUser(PopulatingDB.java:68)
        at prototype.PopulatingDB.<init>(PopulatingDB.java:29)
        at prototype.PopulatingDB.main(PopulatingDB.java:77)
End of Stack Trace

        at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:217)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:305)
        at prototype.PopulatingDB.addUser(PopulatingDB.java:68)
        at prototype.PopulatingDB.<init>(PopulatingDB.java:29)
        at prototype.PopulatingDB.main(PopulatingDB.java:77)
Java Result: 1

_________________________________________________________________
Tell MSN about your most memorable emails!  http://www.emailbritain.co.uk/




Message-ID: <BAY127-F3055D5C84D3E43DEE460F8820A0@phx.gbl>
Permalink:  ../BAY127-F3055D5C84D3E43DEE460F8820A0@phx.gbl/
Also on:    postgresql.org/message-id/BAY127-F3055D5C84D3E43DEE460F8820A0@phx.gbl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mutuah@hotmail.co.uk
  Subject: Re: An I/O error occured while sending to the backend
  In-Reply-To: <BAY127-F3055D5C84D3E43DEE460F8820A0@phx.gbl>
  References: <20070627005819.0D8FE8B2A1F@mx2.hub.org> <BAY127-F3055D5C84D3E43DEE460F8820A0@phx.gbl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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