15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


ODBC Tips & Tricks

Mihir Dalal -- m_dalal@ECE.concordia.CA
Wednesday, February 12, 1997


                       Environment: MSVC 1.52, Win 95

Hi,

I am on the verge of releazing my SDI Complaint, database enabled  
application & have run into a couple of problems with shipping ODBC 
support. 

Problem 1:
I built my odbc.inf file from the default template file shipped with MSVC 
and carefully deleted references to the drivers I don't want to ship. Next I 
copied the required drivers/dlls onto four distributable diskettes.

When I install ODBC support for my application with these diskettes on a 
new system, the ODBC installation proceeds smoothly from disk 1 to disk 4 
and I do exit the ODBC setup without problems. 

The problem is that the "ODBC->ODBC Administrator" group does not get 
created in the StartUp Menu of the new system. 

Am I missing out something ??

Any solution to this ??

Trick1:
Is there a way to include the "ODBC Administrator" into my application 
group through the installation process, rather than installing it as an 
independent entity ??

Any tips for that ??

Trick2:
I would like to programmatically create and setup a default datasource 
through the installation process, rather than manually requiring the user to create 
it later, using the "ODBC Administrator". 

Any tips for that ??

Trick3:
I would like to customize the name "ODBC Adminstrator" to something like 
"MyApp Data Manager".

Any tips for that ??

Mihir. 
_________________________________________________________________________
   Mihir Dalal , M.Engg. (Electrical) Student
            Department of Electrical and Computer Engineering
                   Concordia University, Montreal, Canada
                http://www.ECE.Concordia.CA/~m_dalal/addr.html





Erik Thomas -- ErikThomas@msn.com
Thursday, February 13, 1997

>I would like to programmatically create and setup a default datasource
>through the installation process, rather than manually requiring the user 
>to create it later, using the "ODBC Administrator".

Assuming you are installing ODBCINST.DLL along with your other ODBC
files, you can register a datasource in ODBC.INI programmatically in
the following way (the example assumes you are connecting to an MS 
Access 2 database). Replace  with your values.
		
LPSTR szAttributes =
    "DSN=;"
    "FIL=MS Access;;"
    "JetIniPath=odbcddp.ini;"
    "DBQ=;"
    "DefaultDir=;"
    "Description=;";

return SQLConfigDataSource(NULL,
    ODBC_ADD_DSN,
    "Microsoft Access Driver (*.mdb)",
    szAttributes);  

Also, make the following entry in your .DEF file:

IMPORTS
    ODBCINST.SQLConfigDataSource

To find out exactly what values you need for the szAttributes string, 
install your datasource with ODBCAdm.EXE and then open 
ODBC.INI and view the settings.

Erik Thomas
E.J. Thomas & Associates
ErikThomas@msn.com




Become an MFC-L member | Вернуться в корень Архива |