vr_cal
Member
Friends, I am attempting to write a C BSFN with direct SQL calls. We are a Windows Shop with SQL2008 database.
So far, I have looked at all posts and the tips they provided and I could get as far as having a successful build (no LNK2019 errors)..For some reason, the SQLConnect seems to be still eluding me.
The BSFN returns back the values for the Env handle, Connect Handle. Lastly, the BSFN is supposed to return a "Y" in the cProceed parm and that is what is not happening. That indicates to me that it is failing when trying to do a SQLConnect.
jdeStrncpyTerminate(szEnvironment, JDB_GetEnvironment(NULL), DIM(szEnvironment));
jdeGetEnvironmentPathCode(hUser, szEnvironment, szPathCode);
JDB_GetObjectDataSource(hUser, _J("F4101"), NULL,
0, szDataSource);
jdeStrcpy((JCHAR *)ServerName,(const JCHAR *)szDataSource);
/* Chop off the trailing blanks */
iCounter=sizeof(ServerName);
while(ServerName[iCounter--]<=' ')
{
ServerName[iCounter+1]='\0';
}
*jdeStrcpy(UserName,JDB_GetUser(NULL));
*jdeStrcpy(Authentication,JDB_GetPassword(NULL));
iRetCode = SQLAllocEnv((SQLHENV)&lpDS->idhEnv);
if (MYSQLSUCCESS(iRetCode))
{
iRetCode = SQLAllocConnect((SQLHENV)lpDS->idhEnv,
(SQLHDBC)&lpDS->idhDbc);
if (MYSQLSUCCESS(iRetCode))
{
iRetCode = SQLConnect((SQLHDBC)lpDS->idhDbc,
(SQLWCHAR *) ServerName,
(SQLSMALLINT)DIM(ServerName),
(SQLWCHAR *) UserName,
(SQLSMALLINT)DIM(UserName),
(SQLWCHAR *) Authentication,
(SQLSMALLINT)DIM(Authentication));
if (MYSQLSUCCESS(iRetCode))
{
lpDS->cProceed = _J('Y');
}
}
}
Any help you can provide would be greatly appreciated.....
So far, I have looked at all posts and the tips they provided and I could get as far as having a successful build (no LNK2019 errors)..For some reason, the SQLConnect seems to be still eluding me.
The BSFN returns back the values for the Env handle, Connect Handle. Lastly, the BSFN is supposed to return a "Y" in the cProceed parm and that is what is not happening. That indicates to me that it is failing when trying to do a SQLConnect.
jdeStrncpyTerminate(szEnvironment, JDB_GetEnvironment(NULL), DIM(szEnvironment));
jdeGetEnvironmentPathCode(hUser, szEnvironment, szPathCode);
JDB_GetObjectDataSource(hUser, _J("F4101"), NULL,
0, szDataSource);
jdeStrcpy((JCHAR *)ServerName,(const JCHAR *)szDataSource);
/* Chop off the trailing blanks */
iCounter=sizeof(ServerName);
while(ServerName[iCounter--]<=' ')
{
ServerName[iCounter+1]='\0';
}
*jdeStrcpy(UserName,JDB_GetUser(NULL));
*jdeStrcpy(Authentication,JDB_GetPassword(NULL));
iRetCode = SQLAllocEnv((SQLHENV)&lpDS->idhEnv);
if (MYSQLSUCCESS(iRetCode))
{
iRetCode = SQLAllocConnect((SQLHENV)lpDS->idhEnv,
(SQLHDBC)&lpDS->idhDbc);
if (MYSQLSUCCESS(iRetCode))
{
iRetCode = SQLConnect((SQLHDBC)lpDS->idhDbc,
(SQLWCHAR *) ServerName,
(SQLSMALLINT)DIM(ServerName),
(SQLWCHAR *) UserName,
(SQLSMALLINT)DIM(UserName),
(SQLWCHAR *) Authentication,
(SQLSMALLINT)DIM(Authentication));
if (MYSQLSUCCESS(iRetCode))
{
lpDS->cProceed = _J('Y');
}
}
}
Any help you can provide would be greatly appreciated.....