How can I create a Pervasive Client Interface ODBC Datasource Name using C/C++?
Solution ID:
00016876
Problem Description
PDB_KB_Problem
Problem Environment
PDB_KB_Environment
Pervasive.SQL V8
Cause of the Problem
PDB_KB_Cause
Solution Notes
PDB_KB_Solution
Using the SQLConfigDatasource ODBC API call, a C/C++ application can create a Pervasive Client Interface datasource name. The following code segment will show how to create the Datasource name. The various parameters are defined as:
DSN - Name of the Client DSN.
ServerDSN - Name of the Engine DSN on the remote server.
TCPPort - Defines the TCP/IP port the the engine is using. The default is 1583.
ServerName - Remote Server Name where the ServerDSN is defined.
TransportHint - Tells the requester whether to use TCP/IP or SPX and in which order for communication.
ArrayBufferSize - Size in KB of the ODBC driver buffer cache.
ArrayFetchOn - Determines if the Client ODBC driver uses the buffer cache (0 = No, 1 = Yes).
TranslationDLL - Filename and path to any specific translation DLL being used.
TranslationOption - Enables/Disables Translation using the translation DLL (0 = No, 1 = Yes).
Description - General description of the Datasource Name.
Below is the code:
// odbcdsn.cpp : Defines the entry point for the console application.
//
include "stdafx.h"
include
include
include
include
include
int main(int argc, char* argv[])
{
BOOL rc;
rc = SQLConfigDataSource(NULL, ODBC_ADD_DSN,
"Pervasive ODBC Client Interface",
"DSN=MyODBC\0"
"ServerDSN=DEMODATA\0"
"TCPPort=1583\0"
"ServerName=ServerName\0"
"TransportHint=TCP:SPX\0"
"ArrayBufferSize=8\0"
"ArrayFetchOn=1\0"
"TranslationDLL=\0"
"TranslationOption=\0"
"Description=Pervasive ODBC Client Interface\0\0");
if (!rc)
{
printf("Error on SQLConfigDatasource.\n");
char message [SQL_MAX_MESSAGE_LENGTH];
WORD errCodeIn = 1;
DWORD * errCodeOut = 0L;
SQLInstallerError(errCodeIn, errCodeOut, message, sizeof (message) - 1,
NULL);
printf("Error Message: %s\nError Code: %d",message, errCodeOut);
}
else
{
printf("SQLConfigDatasource worked.\n");
}
return 0;
}
Rating

![1 star selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+ESCAPE to leave rating submit mode.]()
![2 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.]()
![3 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.]()
![4 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.]()
![5 stars selected. Press SHIFT+ENTER to submit. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.]()