[freetds] fix for spurious server not found in configuration file

Christos Zoulas christos at zoulas.com
Fri Nov 13 15:35:10 EST 2009


Hello,

I really don't want to list > 50 servers in my freetds.conf file to avoid
seeing the message:

Msg 20012, Level 2, State -1, Server OpenClient, Line -1
Server name not found in configuration files.

So, I added this to config.c (which was to actually do what the logging
comment promised but did not deliver):

Index: src/tds/config.c
===================================================================
RCS file: /src/twosigma/cvsroot/external/public/freetds/src/tds/config.c,v
retrieving revision 1.1.1.13
retrieving revision 1.16
diff -u -r1.1.1.13 -r1.16
--- src/tds/config.c	13 Nov 2009 18:22:47 -0000	1.1.1.13
+++ src/tds/config.c	13 Nov 2009 19:39:28 -0000	1.16
@@ -195,7 +195,8 @@
 		if (!tds_read_interfaces(tds_dstr_cstr(&login->server_name), connection)) {
 			tdsdump_log(TDS_DBG_INFO1, "Failed to find [%s] in configuration files; trying '%s' instead.\n", 
 						   tds_dstr_cstr(&login->server_name), tds_dstr_cstr(&connection->server_name));
-			tdserror(tds->tds_ctx, tds, TDSEINTF, 0);
+			if (!tds_read_conf_file(connection, tds_dstr_cstr(&connection->server_name)))
+				tdserror(tds->tds_ctx, tds, TDSEINTF, 0);
 		}
 	}
 

So adding
[SYBASE]

to the bottom of your freetds.conf file will silence the nuisance.

Best,

christos



More information about the FreeTDS mailing list