SQLConnect API Problem - need help BAD!!

SQLConnect API Problem - need help BAD!!

Post by Ernie Wegreck » Wed, 19 Aug 1998 04:00:00



When using the SQLConnect API in my VB 5.0 app, I run into a problem  when I
attempt to connect, via ODBC, to a "secured" MS Access database.  I pass a
valid user id and the database password, but it will not connect.  The
SQLState error code is "00000" and the SQLErrorMessage is blank.  Any
suggestions?

Thanks...Ernie

P.S. It works fine when the database is not secured.

 
 
 

1. Win32 ODBC API Question on using SQLConnect() to Personal Oracle8i on Win2000

Hi,

The code below logs into Personal Oracle 8i and retrieves some data.  

Currently, I need to login to Access database and disconnect before I
can login to Personal Oracle 8i.  In other words, if I don't
SUCCESSFULLY connect to ACCESS, login to Oracle fails (pauses
indefinitely).

I do NOT want to connect to ACCESS before connecting to Personal
Oracle 8i.  What am I doing wrong?  

Thanks for your help.

//////////////////////////////////////////////////////////////////////////////////////////////

SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3,
SQL_IS_INTEGER);

// Allocate a new SQLHDBC. If successful then call SQLConnect using
// the allocated hdbc and supplied connection information.
SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);

printf("\n\nAttempting SQLConnect() to Northwind \n\n");
rcode = SQLConnect(hdbc, (SQLCHAR*)szDBNameNW, SQL_NTS,
(SQLCHAR*)szUsername, SQL_NTS, (SQLCHAR*)szPassword, SQL_NTS);

printf("Disconnecting from Northwind \n");
SQLDisconnect(hdbc);

printf("\n\nAttempting SQLConnect() to Oracle8i \n\n");
rcode = SQLConnect(hdbc, (SQLCHAR*)szDBNameO8, SQL_NTS,
(SQLCHAR*)szUsername, SQL_NTS, (SQLCHAR*)szPassword, SQL_NTS);

rcode = SQLAllocStmt(hdbc, &hstmt);
if (rcode == SQL_SUCCESS || rcode == SQL_SUCCESS_WITH_INFO)
{
        // Retrieve CustomerID from the database to buffer & display;
SQLPrepare(hstmt, (unsigned char*) "SELECT ename FROM emp", SQL_NTS);
SQLExecute(hstmt);
        while ( (rcode = SQLFetch(hstmt) ) != SQL_NO_DATA )
        {
        SQLGetData(hstmt, 1, SQL_C_CHAR, buffer, 50, &sdODataLength);
        printf("%s \n", buffer);
        }
SQLFreeStmt(hstmt, SQL_DROP);
SQLDisconnect(hdbc);
SQLFreeHandle(SQL_HANDLE_ENV, henv);

2. Help request !

3. Need help on automating DBA task

4. sqlconnect() need help !!

5. myschema - extent size looks very large

6. Oracle 7.3 and Forms 3.0 -- BAD, BAD, BAD!!!

7. What is difference between SQL Anywhere and Sybase System 11?

8. RDO bad, bad, bad

9. Bound Controls: bad,bad,bad

10. RDO bad, bad, bad

11. Geting bad fonts! need help pd7

12. need help bad