diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c
index 425da775a0c4ce884e7996423afef58de079d6c5..a124a894957ecdc34285155d7e91f8425352ee65 100644
--- a/src/interfaces/ecpg/ecpglib/connect.c
+++ b/src/interfaces/ecpg/ecpglib/connect.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.54 2009/06/11 14:49:13 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.55 2010/05/07 19:35:03 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -475,7 +475,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
 			 host ? host : "<DEFAULT>",
 			 port ? (ecpg_internal_regression_mode ? "<REGRESSION_PORT>" : port) : "<DEFAULT>",
 			 options ? "with options " : "", options ? options : "",
-			 user ? "for user " : "", user ? user : "");
+			 (user && strlen(user) > 0) ? "for user " : "", user ? user : "");
 
 	connect_string = ecpg_alloc(strlen_or_null(host)
 								+ strlen_or_null(port)
@@ -494,8 +494,8 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
 			realname ? "dbname=" : "", realname ? realname : "",
 			host ? "host=" : "", host ? host : "",
 			port ? "port=" : "", port ? port : "",
-			user ? "user=" : "", user ? user : "",
-			passwd ? "password=" : "", passwd ? passwd : "",
+			(user && strlen(user) > 0) ? "user=" : "", user ? user : "",
+			(passwd && strlen(passwd) > 0) ? "password=" : "", passwd ? passwd : "",
 			options ? options : "");
 
 	/*