Creating ODBC data source programmatically

Creating ODBC data source programmatically

Post by Byju Geevarghes » Sun, 31 Dec 1899 09:00:00



I want to create an ODBC data source programmatically for "INFORMIX 3.30
32 BIT"

[VB code]
SQLConfigDataSource(UsrWizard.hWnd, ODBC_ADD_DSN, "INFORMIX 3.30 32
BIT", strAttributes)

where "strAttributes" contains attribute-value pair of DSN, UID, PWD,
SERVER, DB etc.

I  pass the "hWnd" to check the attributes received by the odbc driver.
I get a "dialog" from the driver where I see almost all attributes
except the "DSN".

((How can I contact the developers of the Informix ODBC driver?))

(byju)

  Byju.Geevarghese.vcf
< 1K Download
 
 
 

Creating ODBC data source programmatically

Post by Byju Geevarghes » Sun, 31 Dec 1899 09:00:00


I have discovered my mistake after reading the "Informix ODBC Driver
Programmer's Manual".

The "Figure 2-1 Required DSN Values" gives a list attributes to be used
during "SQLConfigDataSource" call.

After including all those attributes e.g. Protocol,HostName,Service etc.
(in the strAttribute variable), I could create a DSN programmatically.

Bye

Byju

  Byju.Geevarghese.vcf
< 1K Download

 
 
 

1. Data Source: Programmatically Configuring an ODBC Data Source - HELP PLEASE

OP: WIN95
COMPILER: VCPP 5.0 (SVP 2)

I have the above code, and I don't know why the "OPTION 1" does not work.
The contents of "p" in memory is the same as 2nd and 3rd line of the "OPTION
2" before the SQLConfigDataSource function.
Thanks, for any help.

char *p = new char[100];
char cCnt = 0;
memset(p,NULL,100);
CString strDummy = "DNS=TESTESQL";

for(char i=0;i<strDummy.GetLength();i++)
     p[cCnt++] = strDummy.GetAt(i);

p[cCnt++] = NULL;

strDummy = "DBQ=C:\\Projetos\\SRO_CPQD\\SOFTWARE\\PRS
TESTE\\PRS\\MDB\\sro.mdb";

for(i=0;i<strDummy.GetLength();i++)
     p[cCnt++] = strDummy.GetAt(i);
p[cCnt++] = NULL;
BOOL bRet = FALSE;
// ***** OPTION 1 *****
bRet = SQLConfigDataSource(NULL,ODBC_ADD_DSN,"Microsoft Access Driver
(*.mdb)",p);

// ***** OPTION 2 *****
bRet = SQLConfigDataSource(NULL,ODBC_ADD_DSN,"Microsoft Access Driver
(*.mdb)",
        "DSN=TESTESQL\0"
        "DBQ=C:\\Projetos\\SRO_CPQD\\SOFTWARE\\PRS
TESTE\\PRS\\MDB\\sro.mdb\0");


2. CFD: I believe the FAQ needs a new home.

3. programmatically create an ODBC data source?

4. sql Query Result to Ms Access

5. Programmatically creating an ODBC Data Source

6. Job

7. How to create and configure ADO/ODBC Data Source programmatically for MS Acces

8. Restoring a DB

9. ?How to programmatically register an ODBC data source in VC++

10. configure ODBC data source programmatically

11. Create a ODBC Database and Data Source by ODBC API

12. Help:ODBC Data Source Admin doesn't show Names of new Data Sources

13. cannot add MSAccess 97 data source in ODBC Data Source Admin