Hi Krist, Krist van Besien wrote: Yes, my .cgi starts by writing this header (see below). It is written in C. I think the environment is not the problem because LD_LIBRARY_PATH points to the same search paths as the user in which I run the .cgi from the command line. This is my simple .cgi code: #include <stdio.h> #include <sql.h> #include <sqlext.h> void extract_error( char *fn, SQLHANDLE handle, SQLSMALLINT type); void extract_error( char *fn, SQLHANDLE handle, SQLSMALLINT type) { SQLINTEGER i = 0; SQLINTEGER native; SQLCHAR state[ 7 ]; SQLCHAR text[256]; SQLSMALLINT len; SQLRETURN ret; memset(text,0,256); fprintf(stderr, "\n" "The driver reported the following diagnostics whilst running " "%s\n\n", fn); do { ret = SQLGetDiagRec(type, handle, ++i, state, &native, text, sizeof(text), &len ); if (!SQL_SUCCEEDED(ret)) printf("%s:%ld:%ld:%s\n", state, i, native, text); } while( ret == SQL_SUCCESS ); } main() { SQLHENV env; SQLHDBC dbc; SQLHSTMT stmt; SQLRETURN ret; /* ODBC API return status */ SQLSMALLINT columns; /* number of columns in result-set */ int row = 0; //MLR - cgi stuff printf("Content-Type: text/html\n\n"); printf("<html>\n"); printf("<head>"); printf("<link rel=\"stylesheet\" href="" type=\"text/css\">"); /* Allocate an environment handle */ SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); /* We want ODBC 3 support */ SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); /* Allocate a connection handle */ SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc); /* Connect to the DSN mydsn */ /* You will need to change mydsn to one you have created and tested */ SQLDriverConnect(dbc, NULL, "DSN=SXDB;PWD=Scatex;", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT); /* Allocate a statement handle */ SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt); /* Retrieve a list of tables */ SQLTables(stmt, NULL, 0, "SCATEX", SQL_NTS, "MEDIDAS", SQL_NTS, NULL, 0); /* How many columns are there */ SQLNumResultCols(stmt, &columns); /* Loop through the rows in the result-set */ while (SQL_SUCCEEDED(ret = SQLFetch(stmt))) { SQLUSMALLINT i; printf("Row %d\n", row++); /* Loop through the columns */ for (i = 1; i <= columns; i++) { SQLINTEGER indicator; char buf[512]; /* retrieve column data as a string */ ret = SQLGetData(stmt, i, SQL_C_CHAR, buf, sizeof(buf), &indicator); if (SQL_SUCCEEDED(ret)) { /* Handle null columns */ if (indicator == SQL_NULL_DATA) strcpy(buf, "NULL"); printf(" Column %u : %s\n", i, buf); } else { extract_error("SQLAllocHandle for dbc", env, SQL_HANDLE_ENV); exit(-1); } } } /* Free all the handles */ SQLFreeHandle(SQL_HANDLE_STMT, stmt); /* disconnect */ SQLFreeHandle(SQL_HANDLE_DBC, dbc); SQLFreeHandle(SQL_HANDLE_ENV, env); printf("</head>"); printf("<body bgcolor=\"#CCCCCC\" align=\"center\" class=\"fText\">\n"); printf("</body>\n</html>\n"); } Any ideas on what can be the problem would be very appreciated. Best regards, Miguel Rentes |