summaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/org/postgresql/Connection.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/Connection.java')
-rw-r--r--src/interfaces/jdbc/org/postgresql/Connection.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/Connection.java b/src/interfaces/jdbc/org/postgresql/Connection.java
index af507303dd..ec3c49d437 100644
--- a/src/interfaces/jdbc/org/postgresql/Connection.java
+++ b/src/interfaces/jdbc/org/postgresql/Connection.java
@@ -11,7 +11,7 @@ import org.postgresql.util.*;
import org.postgresql.core.*;
/*
- * $Id: Connection.java,v 1.42 2002/03/05 18:00:36 davec Exp $
+ * $Id: Connection.java,v 1.43 2002/03/09 17:08:39 davec Exp $
*
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
* JDBC2 versions of the Connection class.
@@ -139,6 +139,8 @@ public abstract class Connection
*/
protected void openConnection(String host, int port, Properties info, String database, String url, Driver d) throws SQLException
{
+ firstWarning = null;
+
// Throw an exception if the user or password properties are missing
// This occasionally occurs when the client uses the properties version
// of getConnection(), and is a common question on the email lists
@@ -209,7 +211,7 @@ public abstract class Connection
// The most common one to be thrown here is:
// "User authentication failed"
//
- throw new SQLException(pg_stream.ReceiveString(encoding));
+ throw new PSQLException("postgresql.con.misc", pg_stream.ReceiveString(encoding));
case 'R':
// Get the type of request
@@ -304,8 +306,10 @@ public abstract class Connection
ckey = pg_stream.ReceiveIntegerR(4);
break;
case 'E':
+ throw new PSQLException("postgresql.con.backend", pg_stream.ReceiveString(encoding));
case 'N':
- throw new SQLException(pg_stream.ReceiveString(encoding));
+ addWarning(pg_stream.ReceiveString(encoding));
+ break;
default:
throw new PSQLException("postgresql.con.setup");
}
@@ -317,14 +321,11 @@ public abstract class Connection
case 'Z':
break;
case 'E':
- case 'N':
- throw new SQLException(pg_stream.ReceiveString(encoding));
+ throw new PSQLException("postgresql.con.backend", pg_stream.ReceiveString(encoding));
default:
throw new PSQLException("postgresql.con.setup");
}
- firstWarning = null;
-
// "pg_encoding_to_char(1)" will return 'EUC_JP' for a backend compiled with multibyte,
// otherwise it's hardcoded to 'SQL_ASCII'.
// If the backend doesn't know about multibyte we can't assume anything about the encoding
@@ -361,7 +362,6 @@ public abstract class Connection
initObjectTypes();
// Mark the connection as ok, and cleanup
- firstWarning = null;
PG_STATUS = CONNECTION_OK;
}