diff --git a/src/interfaces/jdbc/postgresql/Connection.java b/src/interfaces/jdbc/postgresql/Connection.java
index fdbc936a666c41d7e8be30bddf69e5f92e9934b7..fc30b4dfd6c0e996ce7a0c0fcf7d986abe97e4f4 100644
--- a/src/interfaces/jdbc/postgresql/Connection.java
+++ b/src/interfaces/jdbc/postgresql/Connection.java
@@ -10,7 +10,7 @@ import postgresql.largeobject.*;
 import postgresql.util.*;
 
 /**
- * $Id: Connection.java,v 1.16 1999/05/17 22:43:23 peter Exp $
+ * $Id: Connection.java,v 1.17 1999/05/18 23:17:15 peter Exp $
  *
  * This abstract class is used by postgresql.Driver to open either the JDBC1 or
  * JDBC2 versions of the Connection class.
@@ -95,9 +95,9 @@ public abstract class Connection
     // This occasionally occurs when the client uses the properties version
     // of getConnection(), and is a common question on the email lists
     if(info.getProperty("user")==null)
-      throw new SQLException("The user property is missing. It is mandatory.");
+      throw new PSQLException("postgresql.con.user");
     if(info.getProperty("password")==null)
-      throw new SQLException("The password property is missing. It is mandatory.");
+      throw new PSQLException("postgresql.con.pass");
     
     this_driver = d;
     this_url = new String(url);
@@ -116,9 +116,9 @@ public abstract class Connection
 	// Added by Peter Mount <peter@retep.org.uk>
 	// ConnectException is thrown when the connection cannot be made.
 	// we trap this an return a more meaningful message for the end user
-	throw new SQLException ("Connection refused. Check that the hostname and port is correct, and that the postmaster is running with the -i flag, which enables TCP/IP networking.");
+	throw new PSQLException ("postgresql.con.refused");
       } catch (IOException e) {
-	throw new SQLException ("Connection failed: " + e.toString());
+	throw new PSQLException ("postgresql.con.failed",e);
       }
       
       // Now we need to construct and send a startup packet
@@ -173,11 +173,11 @@ public abstract class Connection
 		    
 		  case AUTH_REQ_KRB4:
 		    DriverManager.println("postgresql: KRB4");
-		    throw new SQLException("Kerberos 4 not supported");
+		    throw new PSQLException("postgresql.con.kerb4");
 		    
 		  case AUTH_REQ_KRB5:
 		    DriverManager.println("postgresql: KRB5");
-		    throw new SQLException("Kerberos 5 not supported");
+		    throw new PSQLException("postgresql.con.kerb5");
 		    
 		  case AUTH_REQ_PASSWORD:
 		    DriverManager.println("postgresql: PASSWORD");
@@ -197,17 +197,17 @@ public abstract class Connection
 		    break;
 		    
 		  default:
-		    throw new SQLException("Authentication type "+areq+" not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or Subnet, and is using a supported authentication scheme.");
+		    throw new PSQLException("postgresql.con.auth",new Integer(areq));
 		  }
 		break;
 		
 	      default:
-		throw new SQLException("error getting authentication request");
+		throw new PSQLException("postgresql.con.authfail");
 	      }
 	    } while(areq != AUTH_REQ_OK);
 	  
 	} catch (IOException e) {
-	  throw new SQLException("Connection failed: " + e.toString());
+	  throw new PSQLException("postgresql.con.failed",e);
 	}
 	
       // Originally we issued a SHOW DATESTYLE statement to find the databases default
@@ -290,7 +290,7 @@ public abstract class Connection
 	    SQLException final_error = null;
 	    
 	    if (sql.length() > 8192)
-		throw new SQLException("SQL Statement too long: " + sql);
+		throw new PSQLException("postgresql.con.toolong",sql);
 	    try
 		{
 		    pg_stream.SendChar('Q');
@@ -299,7 +299,7 @@ public abstract class Connection
 		    pg_stream.SendChar(0);
 		    pg_stream.flush();
 		} catch (IOException e) {
-		    throw new SQLException("I/O Error: " + e.toString());
+		    throw new PSQLException("postgresql.con.ioerror",e);
 		}
 	    
 	    while (!hfr || fqp > 0)
@@ -316,7 +316,7 @@ public abstract class Connection
 			    break;
 			case 'B':	// Binary Data Transfer
 			    if (fields == null)
-				throw new SQLException("Tuple received before MetaData");
+				throw new PSQLException("postgresql.con.tuple");
 			    tup = pg_stream.ReceiveTuple(fields.length, true);
 			    // This implements Statement.setMaxRows()
 			    if(maxrows==0 || tuples.size()<maxrows)
@@ -330,7 +330,7 @@ public abstract class Connection
 					try {
 						update_count = Integer.parseInt(recv_status.substring(1+recv_status.lastIndexOf(' ')));
 					} catch(NumberFormatException nfe) {
-						throw new SQLException("Unable to fathom update count \""+recv_status+"\"");
+						throw new PSQLException("postgresql.con.fathom",recv_status);
 					}
 				}
 			    if (fields != null)
@@ -344,14 +344,14 @@ public abstract class Connection
 					    pg_stream.SendChar(0);
 					    pg_stream.flush();
 					} catch (IOException e) {
-					    throw new SQLException("I/O Error: " + e.toString());
+					    throw new PSQLException("postgresql.con.ioerror",e);
 					}
 				    fqp++;
 				}
 			    break;
 			case 'D':	// Text Data Transfer
 			    if (fields == null)
-				throw new SQLException("Tuple received before MetaData");
+				throw new PSQLException("postgresql.con.tuple");
 			    tup = pg_stream.ReceiveTuple(fields.length, false);
 			    // This implements Statement.setMaxRows()
 			    if(maxrows==0 || tuples.size()<maxrows)
@@ -366,7 +366,7 @@ public abstract class Connection
 			    int t = pg_stream.ReceiveChar();
 			    
 			    if (t != 0)
-				throw new SQLException("Garbled Data");
+				throw new PSQLException("postgresql.con.garbled");
 			    if (fqp > 0)
 				fqp--;
 			    if (fqp == 0)
@@ -380,11 +380,11 @@ public abstract class Connection
 			    break;
 			case 'T':	// MetaData Field Description
 			    if (fields != null)
-				throw new SQLException("Cannot handle multiple result groups");
+				throw new PSQLException("postgresql.con.multres");
 			    fields = ReceiveFields();
 			    break;
 			default:
-			    throw new SQLException("Unknown Response Type: " + (char)c);
+			    throw new PSQLException("postgresql.con.type",new Character((char)c));
 			}
 		}
 	    if (final_error != null)
@@ -587,7 +587,7 @@ public abstract class Connection
 	    sx.fillInStackTrace();
 	    throw sx;
 	} catch(Exception ex) {
-	    throw new SQLException("Failed to create object for "+type+": "+ex);
+	    throw new PSQLException("postgresql.con.creobj",type,ex);
 	}
 	
 	// should never be reached
@@ -622,14 +622,14 @@ public abstract class Connection
 		return ((Serialize)x).store(o);
 	    
 	    // Thow an exception because the type is unknown
-	    throw new SQLException("The object could not be stored. Check that any tables required have already been created in the database.");
+	    throw new PSQLException("postgresql.con.strobj");
 	    
 	} catch(SQLException sx) {
 	    // rethrow the exception. Done because we capture any others next
 	    sx.fillInStackTrace();
 	    throw sx;
 	} catch(Exception ex) {
-	    throw new SQLException("Failed to store object: "+ex);
+	    throw new PSQLException("postgresql.con.strobjex",ex);
 	}
     }
     
diff --git a/src/interfaces/jdbc/postgresql/Driver.java b/src/interfaces/jdbc/postgresql/Driver.java
index c7c4473e0d6510bd3accd0bf3b7890758750fa8c..21d1300a747f6ba70a9591366cd5378f8bc27ccc 100644
--- a/src/interfaces/jdbc/postgresql/Driver.java
+++ b/src/interfaces/jdbc/postgresql/Driver.java
@@ -3,11 +3,6 @@ package postgresql;
 import java.sql.*;
 import java.util.*;
 
-// You will find some mentions to a PSQLException class. This was intended
-// to allow internationalisation of error messages. However, this is not
-// working quite to plan, so the class exists in the source, but it's not
-// quite implemented yet. Peter May 17 1999.
-//
 import postgresql.util.PSQLException;
 
 /**
@@ -109,10 +104,8 @@ public class Driver implements java.sql.Driver
 	return (java.sql.Connection)con;
     } catch(ClassNotFoundException ex) {
 	throw new PSQLException("postgresql.jvm.version",ex);
-	//throw new SQLException("The postgresql.jar file does not contain the correct JDBC classes for this JVM. Try rebuilding.\nException thrown was "+ex.toString());
     } catch(Exception ex2) {
 	throw new PSQLException("postgresql.unusual",ex2);
-	//throw new SQLException("Something unusual has occured to cause the driver to fail. Please report this exception: "+ex2.toString());
     }
     // The old call - remove before posting
     //return new Connection (host(), port(), props, database(), url, this);
@@ -356,7 +349,6 @@ public class Driver implements java.sql.Driver
     public static SQLException notImplemented()
     {
 	return new PSQLException("postgresql.unimplemented");
-	//return new SQLException("This method is not yet implemented.");
     }
 }
 
diff --git a/src/interfaces/jdbc/postgresql/Field.java b/src/interfaces/jdbc/postgresql/Field.java
index 416ddaa7e27c14acf5ec086dc4ee877eb7cbf501..0d3c52adc5fd526d8155f60839cc6c0194c21a16 100644
--- a/src/interfaces/jdbc/postgresql/Field.java
+++ b/src/interfaces/jdbc/postgresql/Field.java
@@ -4,6 +4,7 @@ import java.lang.*;
 import java.sql.*;
 import java.util.*;
 import postgresql.*;
+import postgresql.util.*;
 
 /**
  * postgresql.Field is a class used to describe fields in a PostgreSQL
@@ -62,7 +63,7 @@ public class Field
       if(type_name==null) {
 	ResultSet result = (postgresql.ResultSet)conn.ExecSQL("select typname from pg_type where oid = " + oid);
 	if (result.getColumnCount() != 1 || result.getTupleCount() != 1)
-	  throw new SQLException("Unexpected return from query for type");
+	  throw new PSQLException("postgresql.unexpected");
 	result.next();
 	type_name = result.getString(1);
 	conn.fieldCache.put(new Integer(oid),type_name);
diff --git a/src/interfaces/jdbc/postgresql/PG_Stream.java b/src/interfaces/jdbc/postgresql/PG_Stream.java
index 37870cf52a5b17d2641862c63633b779df887af0..e2ee91ac2f76af3f379f101c033242078d9741b1 100644
--- a/src/interfaces/jdbc/postgresql/PG_Stream.java
+++ b/src/interfaces/jdbc/postgresql/PG_Stream.java
@@ -6,6 +6,7 @@ import java.net.*;
 import java.util.*;
 import java.sql.*;
 import postgresql.*;
+import postgresql.util.*;
 
 /**
  * @version 1.0 15-APR-1997
@@ -22,15 +23,6 @@ public class PG_Stream
   private InputStream pg_input;
   private BufferedOutputStream pg_output;
   
-  // This is the error message returned when an EOF occurs
-  private static final String EOF_MSG = "The backend has broken the connection. Possibly the action you have attempted has caused it to close.";
-  
-  // This is the error message returned when an IOException occurs
-  private static final String IOE_MSG = "IOError while reading from backend: ";
-  
-  // This is the error message returned when flushing the stream.
-  private static final String FLUSH_MSG = "Error flushing output: ";
-  
   /**
    * Constructor:  Connect to the PostgreSQL back end and return
    * a stream connection.
@@ -178,9 +170,9 @@ public class PG_Stream
     try
       {
 	c = pg_input.read();
-	if (c < 0) throw new IOException(EOF_MSG);
+	if (c < 0) throw new PSQLException("postgresql.stream.eof");
       } catch (IOException e) {
-	throw new SQLException(IOE_MSG + e.toString());
+	throw new PSQLException("postgresql.stream.ioerror",e);
       }
       return c;
   }
@@ -203,11 +195,11 @@ public class PG_Stream
 	    int b = pg_input.read();
 	    
 	    if (b < 0)
-	      throw new IOException(EOF_MSG);
+	      throw new PSQLException("postgresql.stream.eof");
 	    n = n | (b << (8 * i)) ;
 	  }
       } catch (IOException e) {
-	throw new SQLException(IOE_MSG + e.toString());
+	throw new PSQLException("postgresql.stream.ioerror",e);
       }
       return n;
   }
@@ -230,11 +222,11 @@ public class PG_Stream
 	    int b = pg_input.read();
 	    
 	    if (b < 0)
-	      throw new IOException(EOF_MSG);
+	      throw new PSQLException("postgresql.stream.eof");
 	    n = b | (n << 8);
 	  }
       } catch (IOException e) {
-	throw new SQLException(IOE_MSG + e.toString());
+	throw new PSQLException("postgresql.stream.ioerror",e);
       }
       return n;
   }
@@ -259,16 +251,16 @@ public class PG_Stream
 	  {
 	    int c = pg_input.read();
 	    if (c < 0)
-	      throw new IOException(EOF_MSG);
+	      throw new PSQLException("postgresql.stream.eof");
 	    else if (c == 0)
 	      break;
 	    else
 	      rst[s++] = (byte)c;
 	  }
 	if (s >= maxsiz)
-	  throw new IOException("Too Much Data");
+	  throw new PSQLException("postgresql.stream.toomuch");
       } catch (IOException e) {
-	throw new SQLException(IOE_MSG + e.toString());
+	throw new PSQLException("postgresql.stream.ioerror",e);
       }
       String v = new String(rst, 0, s);
       return v;
@@ -349,11 +341,11 @@ public class PG_Stream
 	  {
 	    int w = pg_input.read(b, off+s, siz - s);
 	    if (w < 0)
-	      throw new IOException(EOF_MSG);
+	      throw new PSQLException("postgresql.stream.eof");
 	    s += w;
 	  }
       } catch (IOException e) {
-	throw new SQLException(IOE_MSG + e.toString());
+	  throw new PSQLException("postgresql.stream.ioerror",e);
       }
   }
   
@@ -367,7 +359,7 @@ public class PG_Stream
     try {
       pg_output.flush();
     } catch (IOException e) {
-      throw new SQLException(FLUSH_MSG + e.toString());
+      throw new PSQLException("postgresql.stream.flush",e);
     }
   }
   
diff --git a/src/interfaces/jdbc/postgresql/errors.properties b/src/interfaces/jdbc/postgresql/errors.properties
index 2733a256de088e3a8dfa4c4e6fd4db39f38b9db3..7d8e5d4871d01638c6eedd058783db96f2dc1ca0 100644
--- a/src/interfaces/jdbc/postgresql/errors.properties
+++ b/src/interfaces/jdbc/postgresql/errors.properties
@@ -1,4 +1,67 @@
 # This is the default errors
+postgresql.con.auth:The authentication type {1} is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or Subnet, and that it is using an authentication scheme supported by the driver.
+postgresql.con.authfail:An error occured while getting the authentication request.
+postgresql.con.call:Callable Statements are not supported at this time.
+postgresql.con.creobj:Failed to create object for {1} {2}
+postgresql.con.failed:The connection attempt failed because {1}
+postgresql.con.fathom:Unable to fathom update count {1}
+postgresql.con.garbled:Garbled data received.
+postgresql.con.ioerror:An IO erro occured while sending to the backend - {1}
+postgresql.con.kerb4:Kerberos 4 authentication is not supported by this driver.
+postgresql.con.kerb5:Kerberos 5 authentication is not supported by this driver.
+postgresql.con.multres:Cannot handle multiple result groups.
+postgresql.con.pass:The password property is missing. It is mandatory.
+postgresql.con.refused:Connection refused. Check that the hostname and port is correct, and that the postmaster is running with the -i flag, which enables TCP/IP networking.
+postgresql.con.strobj:The object could not be stored. Check that any tables required have already been created in the database.
+postgresql.con.strobjex:Failed to store object - {1}
+postgresql.con.toolong:The SQL Statement is too long - {1}
+postgresql.con.tuple:Tuple received before MetaData.
+postgresql.con.type:Unknown Response Type {1}
+postgresql.con.user:The user property is missing. It is mandatory.
+postgresql.fp.error:FastPath call returned {1}
+postgresql.fp.expint:Fastpath call {1} - No result was returned and we expected an integer.
+postgresql.fp.protocol:FastPath protocol error: {1}
+postgresql.fp.send:Failed to send fastpath call {1} {2}
+postgresql.fp.unknown:The fastpath function {1} is unknown.
+postgresql.geo.box:Conversion of box failed - {1}
+postgresql.geo.circle:Conversion of circle failed - {1}
+postgresql.geo.line:Conversion of line failed - {1}
+postgresql.geo.lseg:Conversion of lseg failed - {1}
+postgresql.geo.path:Cannot tell if path is open or closed.
+postgresql.geo.point:Conversion of point failed - {1}
 postgresql.jvm.version:The postgresql.jar file does not contain the correct JDBC classes for this JVM. Try rebuilding.\nException thrown was {1}
+postgresql.lo.init:failed to initialise LargeObject API
+postgresql.money:conversion of money failed - {1}.
+postgresql.prep.is:InputStream as parameter not supported
+postgresql.prep.param:No value specified for parameter {1}.
+postgresql.prep.range:Parameter index out of range.
+postgresql.prep.type:Unknown Types value.
+postgresql.res.badbigdec:Bad BigDecimal {1}
+postgresql.res.badbyte:Bad Byte {1}
+postgresql.res.baddate:Bad Date Format at {1} in {2}
+postgresql.res.baddouble:Bad Double {1}
+postgresql.res.badfloat:Bad Float {1}
+postgresql.res.badint:Bad Integer {1}
+postgresql.res.badlong:Bad Long {1}
+postgresql.res.badshort:Bad Short {1}
+postgresql.res.badtime:Bad Time {1}
+postgresql.res.badtimestamp:Bad Timestamp Format at {1} in {2}
+postgresql.res.colname:The column name {1} not found.
+postgresql.res.colrange:The column index is out of range.
+postgresql.serial.interface:You cannot serialize an interface.
+postgresql.serial.namelength:Class & Package name length cannot be longer than 32 characters. {1} is {2} characters.
+postgresql.serial.noclass:No class found for {1}.
+postgresql.serial.table:The table for {1} is not in the database. Contact the DBA, as the database is in an inconsistent state.
+postgresql.serial.underscore:Class names may not have _ in them. You supplied {1}.
+postgresql.stat.batch.empty:The batch is empty. There is nothing to execute.
+postgresql.stat.batch.error:Batch entry {1} {2} was aborted.
+postgresql.stat.maxfieldsize:An attempt to setMaxFieldSize() failed - compile time default in force.
+postgresql.stat.noresult:No results were returned by the query.
+postgresql.stat.result:A result was returned by the statement, when none was expected.
+postgresql.stream.eof:The backend has broken the connection. Possibly the action you have attempted has caused it to close.
+postgresql.stream.flush:An I/O error has occured while flushing the output - {1}
+postgresql.stream.ioerror:An I/O error occured while reading from backend - {1}
+postgresql.stream.toomuch:Too much data was received.
 postgresql.unusual:Something unusual has occured to cause the driver to fail. Please report this exception: {1}
 postgresql.unimplemented:This method is not yet implemented.
+postgresql.unexpected:An unexpected result was returned by a query.
diff --git a/src/interfaces/jdbc/postgresql/fastpath/Fastpath.java b/src/interfaces/jdbc/postgresql/fastpath/Fastpath.java
index 232f8f0248581903f75f7b3e290d2aa227fd7e34..a49dfadc309f7d328678cdff276641ce04750168 100644
--- a/src/interfaces/jdbc/postgresql/fastpath/Fastpath.java
+++ b/src/interfaces/jdbc/postgresql/fastpath/Fastpath.java
@@ -93,7 +93,7 @@ public class Fastpath
       stream.flush();
       
     } catch(IOException ioe) {
-      throw new SQLException("Failed to send fastpath call "+fnid+"\n"+ioe);
+      throw new PSQLException("postgresql.fp.send",new Integer(fnid),ioe);
     }
     
     // Now handle the result
@@ -138,7 +138,7 @@ public class Fastpath
 	  //------------------------------
 	  // Error message returned
 	case 'E':
-	  throw new SQLException("Fastpath: "+stream.ReceiveString(4096));
+	  throw new PSQLException("postgresql.fp.error",stream.ReceiveString(4096));
 	  
 	  //------------------------------
 	  // Notice from backend
@@ -156,7 +156,7 @@ public class Fastpath
 	  return result;
 	  
 	default:
-	  throw new SQLException("Fastpath: protocol error. Got '"+((char)in)+"'");
+	  throw new PSQLException("postgresql.fp.protocol",new Character((char)in));
 	}
     }
     }
@@ -199,7 +199,7 @@ public class Fastpath
   {
     Integer i = (Integer)fastpath(name,true,args);
     if(i==null)
-      throw new SQLException("Fastpath:"+name+": no result returned, expected integer");
+      throw new PSQLException("postgresql.fp.expint",name);
     return i.intValue();
   }
   
@@ -292,7 +292,7 @@ public class Fastpath
     // so, until we know we can do this (needs testing, on the TODO list)
     // for now, we throw the exception and do no lookups.
     if(id==null)
-      throw new SQLException("Fastpath: function "+name+" is unknown");
+      throw new PSQLException("postgresql.fp.unknown",name);
     
     return id.intValue();
   }
diff --git a/src/interfaces/jdbc/postgresql/geometric/PGbox.java b/src/interfaces/jdbc/postgresql/geometric/PGbox.java
index 18148326907203939cf25044b8ead705e3f69966..b8af8df065ea6f42417d5ab7c33758a55d04b387 100644
--- a/src/interfaces/jdbc/postgresql/geometric/PGbox.java
+++ b/src/interfaces/jdbc/postgresql/geometric/PGbox.java
@@ -67,7 +67,7 @@ public class PGbox extends PGobject implements Serializable,Cloneable
   {
     PGtokenizer t = new PGtokenizer(value,',');
     if(t.getSize() != 2)
-      throw new SQLException("conversion of box failed - "+value);
+      throw new PSQLException("postgresql.geo.box",value);
     
     point[0] = new PGpoint(t.getToken(0));
     point[1] = new PGpoint(t.getToken(1));
diff --git a/src/interfaces/jdbc/postgresql/geometric/PGcircle.java b/src/interfaces/jdbc/postgresql/geometric/PGcircle.java
index 105ed91a2f07d509bf2d0a30fdd64a2cf23f50f7..016e701331090ba0d77948f3f5b229786839deba 100644
--- a/src/interfaces/jdbc/postgresql/geometric/PGcircle.java
+++ b/src/interfaces/jdbc/postgresql/geometric/PGcircle.java
@@ -67,13 +67,13 @@ public class PGcircle extends PGobject implements Serializable,Cloneable
   {
     PGtokenizer t = new PGtokenizer(PGtokenizer.removeAngle(s),',');
     if(t.getSize() != 2)
-      throw new SQLException("conversion of circle failed - "+s);
+      throw new PSQLException("postgresql.geo.circle",s);
     
     try {
       center = new PGpoint(t.getToken(0));
       radius = Double.valueOf(t.getToken(1)).doubleValue();
     } catch(NumberFormatException e) {
-      throw new SQLException("conversion of circle failed - "+s+" - +"+e.toString());
+      throw new PSQLException("postgresql.geo.circle",e);
     }
   }
   
diff --git a/src/interfaces/jdbc/postgresql/geometric/PGline.java b/src/interfaces/jdbc/postgresql/geometric/PGline.java
index a419ffb5a184a65fc03e12acc07b786e30620de2..c48867e500fd3687e23a74d702beae55b7040ecf 100644
--- a/src/interfaces/jdbc/postgresql/geometric/PGline.java
+++ b/src/interfaces/jdbc/postgresql/geometric/PGline.java
@@ -65,7 +65,7 @@ public class PGline extends PGobject implements Serializable,Cloneable
   {
     PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s),',');
     if(t.getSize() != 2)
-      throw new SQLException("conversion of line failed - "+s);
+      throw new PSQLException("postgresql.geo.line",s);
     
     point[0] = new PGpoint(t.getToken(0));
     point[1] = new PGpoint(t.getToken(1));
diff --git a/src/interfaces/jdbc/postgresql/geometric/PGlseg.java b/src/interfaces/jdbc/postgresql/geometric/PGlseg.java
index 9daddfc91acca43133812037f88f859182d00da6..9fa133e4652fdee2d45fbc6fc08874d32d123171 100644
--- a/src/interfaces/jdbc/postgresql/geometric/PGlseg.java
+++ b/src/interfaces/jdbc/postgresql/geometric/PGlseg.java
@@ -62,7 +62,7 @@ public class PGlseg extends PGobject implements Serializable,Cloneable
   {
     PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s),',');
     if(t.getSize() != 2)
-      throw new SQLException("conversion of lseg failed - "+s);
+      throw new PSQLException("postgresql.geo.lseg");
     
     point[0] = new PGpoint(t.getToken(0));
     point[1] = new PGpoint(t.getToken(1));
diff --git a/src/interfaces/jdbc/postgresql/geometric/PGpath.java b/src/interfaces/jdbc/postgresql/geometric/PGpath.java
index 45c162ac8aa74b1cb183e91d4f31af7a3229e2d2..a5057a661cc25eccdae37f6877fbc4c8a99854e1 100644
--- a/src/interfaces/jdbc/postgresql/geometric/PGpath.java
+++ b/src/interfaces/jdbc/postgresql/geometric/PGpath.java
@@ -62,7 +62,7 @@ public class PGpath extends PGobject implements Serializable,Cloneable
       open = false;
       s = PGtokenizer.removePara(s);
     } else
-      throw new SQLException("cannot tell if path is open or closed");
+      throw new PSQLException("postgresql.geo.path");
     
     PGtokenizer t = new PGtokenizer(s,',');
     int npoints = t.getSize();
diff --git a/src/interfaces/jdbc/postgresql/geometric/PGpoint.java b/src/interfaces/jdbc/postgresql/geometric/PGpoint.java
index 29f2c753460697d20ab11e4c8933070d2130423b..e06828729a2f2073ecf8afb0cfbd17772b979098 100644
--- a/src/interfaces/jdbc/postgresql/geometric/PGpoint.java
+++ b/src/interfaces/jdbc/postgresql/geometric/PGpoint.java
@@ -66,7 +66,7 @@ public class PGpoint extends PGobject implements Serializable,Cloneable
       x = Double.valueOf(t.getToken(0)).doubleValue();
       y = Double.valueOf(t.getToken(1)).doubleValue();
     } catch(NumberFormatException e) {
-      throw new SQLException("conversion of point failed - "+e.toString());
+      throw new PSQLException("postgresql.geo.point",e.toString());
     }
   }
   
diff --git a/src/interfaces/jdbc/postgresql/jdbc1/Connection.java b/src/interfaces/jdbc/postgresql/jdbc1/Connection.java
index 790dfa6ab0d2d151be8e81e88e46383346b57402..f7c88c579a26647c1f55ae8020e7bc5a5a0cc808 100644
--- a/src/interfaces/jdbc/postgresql/jdbc1/Connection.java
+++ b/src/interfaces/jdbc/postgresql/jdbc1/Connection.java
@@ -17,7 +17,7 @@ import postgresql.largeobject.*;
 import postgresql.util.*;
 
 /**
- * $Id: Connection.java,v 1.1 1999/01/17 04:51:53 momjian Exp $
+ * $Id: Connection.java,v 1.2 1999/05/18 23:17:21 peter Exp $
  *
  * A Connection represents a session with a specific database.  Within the
  * context of a Connection, SQL statements are executed and results are
@@ -96,7 +96,7 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
    */
   public java.sql.CallableStatement prepareCall(String sql) throws SQLException
   {
-    throw new SQLException("Callable Statements are not supported at this time");
+    throw new PSQLException("postgresql.con.call");
     //		return new CallableStatement(this, sql);
   }
   
@@ -311,7 +311,7 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
    */
   public void setTransactionIsolation(int level) throws SQLException
   {
-    throw new SQLException("Transaction Isolation Levels are not implemented");
+    throw postgresql.Driver.notImplemented();
   }
   
   /**
diff --git a/src/interfaces/jdbc/postgresql/jdbc1/PreparedStatement.java b/src/interfaces/jdbc/postgresql/jdbc1/PreparedStatement.java
index f56ca20cc11399fdeb1672c3ede7cac5a9cb371a..69bb426624bc934707c4e526221a456df5a6d4f8 100644
--- a/src/interfaces/jdbc/postgresql/jdbc1/PreparedStatement.java
+++ b/src/interfaces/jdbc/postgresql/jdbc1/PreparedStatement.java
@@ -93,7 +93,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 		for (i = 0 ; i < inStrings.length ; ++i)
 		{
 			if (inStrings[i] == null)
-				throw new SQLException("No value specified for parameter " + (i + 1));
+				throw new PSQLException("postgresql.prep.param",new Integer(i + 1));
 			s.append (templateStrings[i]);
 			s.append (inStrings[i]);
 		}
@@ -118,7 +118,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 		for (i = 0 ; i < inStrings.length ; ++i)
 		{
 			if (inStrings[i] == null)
-				throw new SQLException("No value specified for parameter " + (i + 1));
+				throw new PSQLException("postgresql.prep.param",new Integer(i + 1));
 			s.append (templateStrings[i]);
 			s.append (inStrings[i]);
 		}
@@ -411,7 +411,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 	 */
 	public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
 	{
-		throw new SQLException("InputStream as parameter not supported");
+	    throw postgresql.Driver.notImplemented();
 	}
 
 	/**
@@ -486,7 +486,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 				setString(parameterIndex, ((PGobject)x).getValue());
 				break;
 			default:
-				throw new SQLException("Unknown Types value");
+				throw new PSQLException("postgresql.prep.type");
 		}
 	}
 
@@ -550,7 +550,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 		for (i = 0 ; i < inStrings.length ; ++i)
 		{
 			if (inStrings[i] == null)
-				throw new SQLException("No value specified for parameter " + (i + 1));
+				throw new PSQLException("postgresql.prep.param",new Integer(i + 1));
 			s.append (templateStrings[i]);
 			s.append (inStrings[i]);
 		}
@@ -594,7 +594,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 	private void set(int paramIndex, String s) throws SQLException
 	{
 		if (paramIndex < 1 || paramIndex > inStrings.length)
-			throw new SQLException("Parameter index out of range");
+			throw new PSQLException("postgresql.prep.range");
 		inStrings[paramIndex - 1] = s;
 	}
 }
diff --git a/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java b/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java
index 05dd010c8f1a2375cdaec591c8aa6db0987d8a5b..fca14e64d92fb01ad960075d00aa24549956a856 100644
--- a/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java
+++ b/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java
@@ -143,7 +143,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
     //return null;
     //return new String(bytes);
     if (columnIndex < 1 || columnIndex > fields.length)
-      throw new SQLException("Column Index out of range");
+      throw new PSQLException("postgresql.res.colrange");
     wasNullFlag = (this_row[columnIndex - 1] == null);
     if(wasNullFlag)
       return null;
@@ -186,7 +186,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Byte.parseByte(s);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException("Bad Byte Form: " + s);
+	    throw new PSQLException("postgresql.res.badbyte",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -209,7 +209,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Short.parseShort(s);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException("Bad Short Form: " + s);
+	    throw new PSQLException("postgresql.res.badshort",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -232,7 +232,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Integer.parseInt(s);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad Integer Form: " + s);
+	    throw new PSQLException ("postgresql.badint",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -255,7 +255,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Long.parseLong(s);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad Long Form: " + s);
+	    throw new PSQLException ("postgresql.res.badlong",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -278,7 +278,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Float.valueOf(s).floatValue();
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad Float Form: " + s);
+	    throw new PSQLException ("postgresql.res.badfloat",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -301,7 +301,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Double.valueOf(s).doubleValue();
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad Double Form: " + s);
+	    throw new PSQLException ("postgresql.res.baddouble",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -327,13 +327,13 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    val = new BigDecimal(s);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad BigDecimal Form: " + s);
+	    throw new PSQLException ("postgresql.res.badbigdec",s);
 	  }
 	  try
 	    {
 	      return val.setScale(scale);
 	    } catch (ArithmeticException e) {
-	      throw new SQLException ("Bad BigDecimal Form: " + s);
+		throw new PSQLException ("postgresql.res.badbigdec",s);
 	    }
       }
     return null;		// SQL NULL
@@ -357,7 +357,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
   public byte[] getBytes(int columnIndex) throws SQLException
   {
     if (columnIndex < 1 || columnIndex > fields.length)
-      throw new SQLException("Column Index out of range");
+      throw new PSQLException("postgresql.res.colrange");
     wasNullFlag = (this_row[columnIndex - 1] == null);
     
     // Handle OID's as BLOBS
@@ -390,7 +390,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
     try {
       return new java.sql.Date(df.parse(s).getTime());
     } catch (ParseException e) {
-      throw new SQLException("Bad Date Format: at " + e.getErrorOffset() + " in " + s);
+      throw new PSQLException("postgresql.res.baddate",new Integer(e.getErrorOffset()),s);
     }
   }
   
@@ -417,7 +417,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	    int sec = (s.length() == 5) ? 0 : Integer.parseInt(s.substring(6));
 	    return new Time(hr, min, sec);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad Time Form: " + s);
+	    throw new PSQLException ("postgresql.res.badtime",s);
 	  }
       }
     return null;		// SQL NULL
@@ -448,7 +448,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  java.util.Date d = df.parse(s);
 	  return new Timestamp(d.getTime());
 	} catch (ParseException e) {
-	  throw new SQLException("Bad Timestamp Format: at " + e.getErrorOffset() + " in " + s);
+	  throw new PSQLException("postgresql.res.badtimestamp",new Integer(e.getErrorOffset()),s);
 	}
       }
     return null;                // SQL NULL
@@ -697,7 +697,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
     Field field;
     
     if (columnIndex < 1 || columnIndex > fields.length)
-      throw new SQLException("Column index out of range");
+      throw new PSQLException("postgresql.res.colrange");
     field = fields[columnIndex - 1];
     
     // some fields can be null, mainly from those returned by MetaData methods
@@ -770,7 +770,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
     for (i = 0 ; i < fields.length; ++i)
       if (fields[i].name.equalsIgnoreCase(columnName))
 	return (i+1);
-    throw new SQLException ("Column name not found");
+    throw new PSQLException ("postgresql.res.colname",columnName);
   }
 }
 
diff --git a/src/interfaces/jdbc/postgresql/jdbc1/ResultSetMetaData.java b/src/interfaces/jdbc/postgresql/jdbc1/ResultSetMetaData.java
index 25878dd8c8879db04d75a5e4f71509f10680b540..0502dcdc5694b964871e3a8a25eb3bd87a75fdbe 100644
--- a/src/interfaces/jdbc/postgresql/jdbc1/ResultSetMetaData.java
+++ b/src/interfaces/jdbc/postgresql/jdbc1/ResultSetMetaData.java
@@ -8,6 +8,7 @@ package postgresql.jdbc1;
 import java.lang.*;
 import java.util.*;
 import postgresql.*;
+import postgresql.util.*;
 
 // We explicitly import classes here as the original line:
 //import java.sql.*;
@@ -424,7 +425,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
   private Field getField(int columnIndex) throws SQLException
   {
     if (columnIndex < 1 || columnIndex > fields.length)
-      throw new SQLException("Column index out of range");
+      throw new PSQLException("postgresql.res.colrange");
     return fields[columnIndex - 1];
   }
 }
diff --git a/src/interfaces/jdbc/postgresql/jdbc1/Statement.java b/src/interfaces/jdbc/postgresql/jdbc1/Statement.java
index 4bc026331b9c8778bba26654ed1831d8a8b9e5d6..0f458acec7530ef5279386c7718d494810440b58 100644
--- a/src/interfaces/jdbc/postgresql/jdbc1/Statement.java
+++ b/src/interfaces/jdbc/postgresql/jdbc1/Statement.java
@@ -7,6 +7,8 @@ package postgresql.jdbc1;
 
 import java.sql.*;
 
+import postgresql.util.PSQLException;
+
 /**
  * A Statement object is used for executing a static SQL statement and
  * obtaining the results produced by it.
@@ -52,7 +54,7 @@ public class Statement implements java.sql.Statement
 		while (result != null && !((postgresql.ResultSet)result).reallyResultSet())
 			result = ((postgresql.ResultSet)result).getNext();
 		if (result == null)
-			throw new SQLException("no results returned");
+			throw new PSQLException("postgresql.stat.noresult");
 		return result;
 	}
 
@@ -69,7 +71,7 @@ public class Statement implements java.sql.Statement
 	{
 		this.execute(sql);
 		if (((postgresql.ResultSet)result).reallyResultSet())
-			throw new SQLException("results returned");
+			throw new PSQLException("postgresql.stat.result");
 		return this.getUpdateCount();
 	}
 
@@ -114,7 +116,7 @@ public class Statement implements java.sql.Statement
 	 */
 	public void setMaxFieldSize(int max) throws SQLException
 	{
-		throw new SQLException("Attempt to setMaxFieldSize failed - compile time default");
+		throw new PSQLException("postgresql.stat.maxfieldsize");
 	}
 
 	/**
diff --git a/src/interfaces/jdbc/postgresql/jdbc2/Connection.java b/src/interfaces/jdbc/postgresql/jdbc2/Connection.java
index 53e1bd6529572124879d5c1c8729de5d6e145fb5..7e086435b2018fa127ce2ebc9e041f4a05430b97 100644
--- a/src/interfaces/jdbc/postgresql/jdbc2/Connection.java
+++ b/src/interfaces/jdbc/postgresql/jdbc2/Connection.java
@@ -17,7 +17,7 @@ import postgresql.largeobject.*;
 import postgresql.util.*;
 
 /**
- * $Id: Connection.java,v 1.1 1999/01/17 04:51:56 momjian Exp $
+ * $Id: Connection.java,v 1.2 1999/05/18 23:17:26 peter Exp $
  *
  * A Connection represents a session with a specific database.  Within the
  * context of a Connection, SQL statements are executed and results are
@@ -96,7 +96,7 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
    */
   public java.sql.CallableStatement prepareCall(String sql) throws SQLException
   {
-    throw new SQLException("Callable Statements are not supported at this time");
+    throw new PSQLException("postgresql.con.call");
     //		return new CallableStatement(this, sql);
   }
   
@@ -311,7 +311,7 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
    */
   public void setTransactionIsolation(int level) throws SQLException
   {
-    throw new SQLException("Transaction Isolation Levels are not implemented");
+      throw postgresql.Driver.notImplemented();
   }
   
   /**
diff --git a/src/interfaces/jdbc/postgresql/jdbc2/PreparedStatement.java b/src/interfaces/jdbc/postgresql/jdbc2/PreparedStatement.java
index ef18bbaa9afa923668f71cfd860378994867e41a..b0011aa36f53ae9ff9f26323d0b5cc7ae9395d81 100644
--- a/src/interfaces/jdbc/postgresql/jdbc2/PreparedStatement.java
+++ b/src/interfaces/jdbc/postgresql/jdbc2/PreparedStatement.java
@@ -93,7 +93,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 		for (i = 0 ; i < inStrings.length ; ++i)
 		{
 			if (inStrings[i] == null)
-				throw new SQLException("No value specified for parameter " + (i + 1));
+				throw new PSQLException("postgresql.prep.param",new Integer(i + 1));
 			s.append (templateStrings[i]);
 			s.append (inStrings[i]);
 		}
@@ -118,7 +118,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 		for (i = 0 ; i < inStrings.length ; ++i)
 		{
 			if (inStrings[i] == null)
-				throw new SQLException("No value specified for parameter " + (i + 1));
+				throw new PSQLException("postgresql.prep.param",new Integer(i + 1));
 			s.append (templateStrings[i]);
 			s.append (inStrings[i]);
 		}
@@ -414,7 +414,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 	 */
 	public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
 	{
-		throw new SQLException("InputStream as parameter not supported");
+		throw new PSQLException("postgresql.prep.is");
 	}
 
 	/**
@@ -489,7 +489,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 				setString(parameterIndex, ((PGobject)x).getValue());
 				break;
 			default:
-				throw new SQLException("Unknown Types value");
+				throw new PSQLException("postgresql.prep.type");
 		}
 	}
 
@@ -553,7 +553,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 		for (i = 0 ; i < inStrings.length ; ++i)
 		{
 			if (inStrings[i] == null)
-				throw new SQLException("No value specified for parameter " + (i + 1));
+				throw new PSQLException("postgresql.prep.param",new Integer(i + 1));
 			s.append (templateStrings[i]);
 			s.append (inStrings[i]);
 		}
@@ -597,7 +597,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
 	private void set(int paramIndex, String s) throws SQLException
 	{
 		if (paramIndex < 1 || paramIndex > inStrings.length)
-			throw new SQLException("Parameter index out of range");
+			throw new PSQLException("postgresql.prep.range");
 		inStrings[paramIndex - 1] = s;
 	}
     
diff --git a/src/interfaces/jdbc/postgresql/jdbc2/ResultSet.java b/src/interfaces/jdbc/postgresql/jdbc2/ResultSet.java
index 2be4ddba5ff36b006694e9845a766b84a1f8dbc8..0e8b661d232cba2ca4b0d9ceb54e0c27d98d8901 100644
--- a/src/interfaces/jdbc/postgresql/jdbc2/ResultSet.java
+++ b/src/interfaces/jdbc/postgresql/jdbc2/ResultSet.java
@@ -144,7 +144,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
     //return null;
     //return new String(bytes);
     if (columnIndex < 1 || columnIndex > fields.length)
-      throw new SQLException("Column Index out of range");
+      throw new PSQLException("postgresql.res.colrange");
     wasNullFlag = (this_row[columnIndex - 1] == null);
     if(wasNullFlag)
       return null;
@@ -187,7 +187,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Byte.parseByte(s);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException("Bad Byte Form: " + s);
+	    throw new PSQLException("postgresql.res.badbyte",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -210,7 +210,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Short.parseShort(s);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException("Bad Short Form: " + s);
+	    throw new PSQLException("postgresql.res.badshort",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -233,7 +233,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Integer.parseInt(s);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad Integer Form: " + s);
+	    throw new PSQLException ("postgresql.res.badint",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -256,7 +256,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Long.parseLong(s);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad Long Form: " + s);
+	    throw new PSQLException ("postgresql.res.badlong",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -279,7 +279,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Float.valueOf(s).floatValue();
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad Float Form: " + s);
+	    throw new PSQLException ("postgresql.res.badfloat",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -302,7 +302,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    return Double.valueOf(s).doubleValue();
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad Double Form: " + s);
+	    throw new PSQLException ("postgresql.res.baddouble",s);
 	  }
       }
     return 0;		// SQL NULL
@@ -329,13 +329,13 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  {
 	    val = new BigDecimal(s);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad BigDecimal Form: " + s);
+	    throw new PSQLException ("postgresql.res.badbigdec",s);
 	  }
 	  try
 	    {
 	      return val.setScale(scale);
 	    } catch (ArithmeticException e) {
-	      throw new SQLException ("Bad BigDecimal Form: " + s);
+	      throw new PSQLException ("postgresql.res.badbigdec",s);
 	    }
       }
     return null;		// SQL NULL
@@ -359,7 +359,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
   public byte[] getBytes(int columnIndex) throws SQLException
   {
     if (columnIndex < 1 || columnIndex > fields.length)
-      throw new SQLException("Column Index out of range");
+      throw new PSQLException("postgresql.res.colrange");
     wasNullFlag = (this_row[columnIndex - 1] == null);
     
     // Handle OID's as BLOBS
@@ -392,7 +392,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
     try {
       return new java.sql.Date(df.parse(s).getTime());
     } catch (ParseException e) {
-      throw new SQLException("Bad Date Format: at " + e.getErrorOffset() + " in " + s);
+      throw new PSQLException("postgresql.res.baddate",new Integer(e.getErrorOffset()),s);
     }
   }
   
@@ -419,7 +419,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	    int sec = (s.length() == 5) ? 0 : Integer.parseInt(s.substring(6));
 	    return new Time(hr, min, sec);
 	  } catch (NumberFormatException e) {
-	    throw new SQLException ("Bad Time Form: " + s);
+	    throw new PSQLException ("postgresql.res.badtime",s);
 	  }
       }
     return null;		// SQL NULL
@@ -450,7 +450,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
 	  java.util.Date d = df.parse(s);
 	  return new Timestamp(d.getTime());
 	} catch (ParseException e) {
-	  throw new SQLException("Bad Timestamp Format: at " + e.getErrorOffset() + " in " + s);
+	  throw new PSQLException("postgresql.res.badtimestamp",new Integer(e.getErrorOffset()),s);
 	}
       }
     return null;                // SQL NULL
@@ -711,7 +711,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
     Field field;
     
     if (columnIndex < 1 || columnIndex > fields.length)
-      throw new SQLException("Column index out of range");
+      throw new PSQLException("postgresql.res.colrange");
     field = fields[columnIndex - 1];
     
     // some fields can be null, mainly from those returned by MetaData methods
@@ -784,7 +784,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe
     for (i = 0 ; i < fields.length; ++i)
       if (fields[i].name.equalsIgnoreCase(columnName))
 	return (i+1);
-    throw new SQLException ("Column name not found");
+    throw new PSQLException ("postgresql.res.colname",columnName);
   }
     
     // ** JDBC 2 Extensions **
diff --git a/src/interfaces/jdbc/postgresql/jdbc2/ResultSetMetaData.java b/src/interfaces/jdbc/postgresql/jdbc2/ResultSetMetaData.java
index 8ac88b905f42a51ef468f54e356d59e994de24c0..84aeafec6539e61502aae6b2899a28d416a51f01 100644
--- a/src/interfaces/jdbc/postgresql/jdbc2/ResultSetMetaData.java
+++ b/src/interfaces/jdbc/postgresql/jdbc2/ResultSetMetaData.java
@@ -9,6 +9,7 @@ import java.lang.*;
 import java.sql.*;
 import java.util.*;
 import postgresql.*;
+import postgresql.util.*;
 
 /**
  * A ResultSetMetaData object can be used to find out about the types and
@@ -419,7 +420,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
   private Field getField(int columnIndex) throws SQLException
   {
     if (columnIndex < 1 || columnIndex > fields.length)
-      throw new SQLException("Column index out of range");
+      throw new PSQLException("postgresql.res.colrange");
     return fields[columnIndex - 1];
   }
     
diff --git a/src/interfaces/jdbc/postgresql/jdbc2/Statement.java b/src/interfaces/jdbc/postgresql/jdbc2/Statement.java
index 4c9c8c9e015dcb144abf4550d2dc247e861cf324..26011ba7658e4fd6d5713603ac32953dd3efbbb4 100644
--- a/src/interfaces/jdbc/postgresql/jdbc2/Statement.java
+++ b/src/interfaces/jdbc/postgresql/jdbc2/Statement.java
@@ -7,6 +7,7 @@ package postgresql.jdbc2;
 
 import java.sql.*;
 import java.util.Vector;
+import postgresql.util.*;
 
 /**
  * A Statement object is used for executing a static SQL statement and
@@ -54,7 +55,7 @@ public class Statement implements java.sql.Statement
 		while (result != null && !((postgresql.ResultSet)result).reallyResultSet())
 			result = ((postgresql.ResultSet)result).getNext();
 		if (result == null)
-			throw new SQLException("no results returned");
+			throw new PSQLException("postgresql.stat.noresult");
 		return result;
 	}
 
@@ -71,7 +72,7 @@ public class Statement implements java.sql.Statement
 	{
 		this.execute(sql);
 		if (((postgresql.ResultSet)result).reallyResultSet())
-			throw new SQLException("results returned");
+			throw new PSQLException("postgresql.stat.result");
 		return this.getUpdateCount();
 	}
 
@@ -116,7 +117,7 @@ public class Statement implements java.sql.Statement
 	 */
 	public void setMaxFieldSize(int max) throws SQLException
 	{
-		throw new SQLException("Attempt to setMaxFieldSize failed - compile time default");
+		throw new PSQLException("postgresql.stat.maxfieldsize");
 	}
 
 	/**
@@ -341,7 +342,7 @@ public class Statement implements java.sql.Statement
     public int[] executeBatch() throws SQLException
     {
 	if(batch==null || batch.isEmpty())
-	    throw new SQLException("The batch is empty.");
+	    throw new PSQLException("postgresql.stat.batch.empty");
 	
 	int size=batch.size();
 	int[] result=new int[size];
@@ -353,7 +354,7 @@ public class Statement implements java.sql.Statement
 	    this.execute("commit"); // PTM: check this
 	} catch(SQLException e) {
 	    this.execute("abort"); // PTM: check this
-	    throw new SQLException("The result "+i+" \""+batch.elementAt(i)+"\" aborted.");
+	    throw new PSQLException("postgresql.stat.batch.error",new Integer(i),batch.elementAt(i));
 	}
 	return result;
     }
diff --git a/src/interfaces/jdbc/postgresql/largeobject/LargeObject.java b/src/interfaces/jdbc/postgresql/largeobject/LargeObject.java
index e2d394bf0510797fa12bad6e46c74a4f817f7e33..5def87966745e18fc6ff928f022b0239efbb9cf2 100644
--- a/src/interfaces/jdbc/postgresql/largeobject/LargeObject.java
+++ b/src/interfaces/jdbc/postgresql/largeobject/LargeObject.java
@@ -261,7 +261,7 @@ public class LargeObject
    */
   public InputStream getInputStream() throws SQLException
   {
-    throw new SQLException("LargeObject:getInputStream not implemented");
+    throw postgresql.Driver.notImplemented();
   }
   
   /**
@@ -274,6 +274,6 @@ public class LargeObject
    */
   public OutputStream getOutputStream() throws SQLException
   {
-    throw new SQLException("LargeObject:getOutputStream not implemented");
+    throw postgresql.Driver.notImplemented();
   }
 }
diff --git a/src/interfaces/jdbc/postgresql/largeobject/LargeObjectManager.java b/src/interfaces/jdbc/postgresql/largeobject/LargeObjectManager.java
index 081b8b874a74b9cc50d9f1bc16691c1922581259..d82307281ee0beb855c9f43f4c30f00b45477200 100644
--- a/src/interfaces/jdbc/postgresql/largeobject/LargeObjectManager.java
+++ b/src/interfaces/jdbc/postgresql/largeobject/LargeObjectManager.java
@@ -7,6 +7,7 @@ import java.util.*;
 import java.sql.*;
 
 import postgresql.fastpath.*;
+import postgresql.util.*;
 
 /**
  * This class implements the large object interface to postgresql.
@@ -113,7 +114,7 @@ public class LargeObjectManager
 				      "    or proname = 'lowrite'");
     
     if(res==null)
-      throw new SQLException("failed to initialise LargeObject API");
+      throw new PSQLException("postgresql.lo.init");
     
     fp.addFunctions(res);
     res.close();
diff --git a/src/interfaces/jdbc/postgresql/util/PGmoney.java b/src/interfaces/jdbc/postgresql/util/PGmoney.java
index c2dcb3fad77cb97eee8ad110123ebc642855b8c3..0d094dbf10846552134f2f806269e220f3b770b3 100644
--- a/src/interfaces/jdbc/postgresql/util/PGmoney.java
+++ b/src/interfaces/jdbc/postgresql/util/PGmoney.java
@@ -65,7 +65,7 @@ public class PGmoney extends PGobject implements Serializable,Cloneable
       val = negative ? -val : val;
 
     } catch(NumberFormatException e) {
-      throw new SQLException("conversion of money failed - "+e.toString());
+      throw new PSQLException("postgresql.money",e);
     }
   }
   
diff --git a/src/interfaces/jdbc/postgresql/util/PSQLException.java b/src/interfaces/jdbc/postgresql/util/PSQLException.java
index 1a0d1973587af80abb1e34f042d73d7970c5dc8c..317176a341b6024bbb2787c6a27d99e56a445b52 100644
--- a/src/interfaces/jdbc/postgresql/util/PSQLException.java
+++ b/src/interfaces/jdbc/postgresql/util/PSQLException.java
@@ -45,6 +45,18 @@ public class PSQLException extends SQLException
 	translate(error,argv);
     }
     
+    /**
+     * Helper version for 2 args
+     */
+    public PSQLException(String error,Object arg1,Object arg2)
+    {
+	super();
+	Object[] argv = new Object[2];
+	argv[0] = arg1;
+	argv[1] = arg2;
+	translate(error,argv);
+    }
+    
     /**
      * This does the actual translation
      */
diff --git a/src/interfaces/jdbc/postgresql/util/Serialize.java b/src/interfaces/jdbc/postgresql/util/Serialize.java
index 56018490688e40d7421e43abaf072056a8750094..3209f58105e4007592f944bd0b686af72dcd5bfd 100644
--- a/src/interfaces/jdbc/postgresql/util/Serialize.java
+++ b/src/interfaces/jdbc/postgresql/util/Serialize.java
@@ -45,7 +45,7 @@ public class Serialize
       className = toClassName(type);
       ourClass = Class.forName(className);
     } catch(ClassNotFoundException cnfe) {
-      throw new SQLException("No class found for '"+type+"`");
+      throw new PSQLException("postgresql.serial.noclass",type);
     }
     
     // Second check, the type must be a table
@@ -58,7 +58,7 @@ public class Serialize
     }
     // This should never occur, as postgresql has it's own internal checks
     if(!status)
-      throw new SQLException("The table for "+type+" is not in the database. Contact the DBA, as the database is in an inconsistent state.");
+      throw new PSQLException("postgresql.serial.table",type);
     
     // Finally cache the fields within the table
   }
@@ -106,7 +106,7 @@ public class Serialize
 	}
 	rs.close();
       } else
-       throw new SQLException("Unexpected result from query");
+       throw new PSQLException("postgresql.unexpected");
       return obj;
     } catch(IllegalAccessException iae) {
       throw new SQLException(iae.toString());
@@ -231,7 +231,7 @@ public class Serialize
   public static void create(postgresql.Connection con,Class c) throws SQLException
   {
     if(c.isInterface())
-      throw new SQLException("Cannot serialize an Interface");
+      throw new PSQLException("postgresql.serial.interface");
     
     // See if the table exists
     String tableName = toPostgreSQL(c.getName());
@@ -316,10 +316,10 @@ public class Serialize
     name = name.toLowerCase();
     
     if(name.indexOf("_")>-1)
-      throw new SQLException("Class names may not have _ in them: "+name);
+      throw new PSQLException("postgresql.serial.underscore");
     
     if(name.length()>32)
-      throw new SQLException("Class & Package name length cannot be longer than 32 characters. "+name+" is "+name.length()+" characters.");
+      throw new PSQLException("postgresql.serial.namelength",name,new Integer(name.length()));
     
     return name.replace('.','_');
   }