Backed broken the connection

From: Chitta Barik <Chitta(dot)Barik(at)genband(dot)com>
To: "'pgsql-jdbc(at)postgresql(dot)org'" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Backed broken the connection
Date: 2001-11-20 16:47:52
Message-ID: AB209393C95AD411961600D0B7819F6C03D02CC4@gbexc.genband.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

hi all,

I am first time using PostgreSQL with Java and having some problem while
cancelling the executing query.

I am using JDBC Driver 7.0-1.2 . And i am accessing database from a GUI [
Swing based application ]. The problem is

" When an end user executes a query i am showing a wait dialog till the
query returns results. If the user clicks on "Cancel" in between then I am
getting following exception after that connection dies to the database. I
don't have any other option than closing the application and restarting it
again "

Here is the exception.
"The backend has broken the connection. Possibly the action you have
attempted has caused it to close.
at org.postgresql.PG_Stream.ReceiveChar(PG_Stream.java:178)
at org.postgresql.Connection.ExecSQL(Connection.java:340)
at org.postgresql.jdbc2.Statement.execute(Statement.java:273)
at org.postgresql.jdbc2.Statement.executeQuery(Statement.java:54)
...........
"

I have some debugging statement which prints the connection object itself.
But the object is not null that means the connection has not broken but i
could see the above exception.

Hope you understood my problem. and reply at the earliest will be
appreciated.

Environment :-

GUI :- Swing Based Application
OS :- Solaris
JDBC Driver version :- 7.0-1.2

Below you can have a look at my client code. If you want i can send my
ConnectionManager code too.

// This is the starting point for where execution starts

// Query -> SQL Query
private void executeQuery(String query){
ExecuteThread execThread = new ExecuteThread(query);
try{
execThread.start();
// This shows a wait dialog
VmGuiWaitDialog dialog = new VmGuiWaitDialog("Executing query
......???", new JFrame(),true);
dialog.show();
// checks if cancel clicked or by any chance Thread
interrupted.
if(dialog.isInterrupted() || execThread.isInterrupted()){
execThread.interrupt();
}
}catch(Exception e){
}
}

class ExecuteThread extends Thread{
String query = null;
public ExecuteThread(String query){
this.query = query;
}
public void run(){
try{
// This is the class from where user gets a Connection
to the database.
VmGuiCtQueryResults resultObj =
VmGuiCtQueryResults.getInstance();

// This method executes the query using Statement object
Vector result = resultObj.getQueryResultsList(query);
if(result != null && result.size() > 0){
}else {
dialog.setVisible(false);
VmGuiInfoDialog dlg = new
VmGuiInfoDialog(NO_RESULTS_FOUND,new JFrame());
dlg.show();
}
}catch(Exception e){
}
}
}

thanks,
-chitta barik

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2001-11-20 17:33:31 Re: Serialize its create method throws NullPointerException
Previous Message Michael Andreasen 2001-11-20 14:19:19 No rows returned when rows are there!