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

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


Compressing an Access MDB through ODBC

Erik Thomas -- ErikThomas@msn.com
Thursday, March 06, 1997

Environment: VC++ 1.52c, Win 95

Does anyone know if it is possible, and if so, how to compact an Access 2.0 
database (*.mdb) programmatically through ODBC? CDatabase does not encapsulate 
this functionality, but ODBC administrator does provide an option to compact 
an Access 2.0 database interactively, so the Access driver does seem to 
include this functionality. I have scoured the ODBC 2.0 Programmer's Reference 
and SDK Guide, and my MSDN CD to no avail. Any suggestions?

Thanks.

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



Dong Chen -- d_chen@ix.netcom.com
Friday, March 07, 1997

[Mini-digest: 5 responses]

You can do this by using ODBC API function: 
SQLConfigDataSource()
See on-online help for details.
--
Dong
d_chen@ix.netcom.com

----------
> From: Erik Thomas 
> To: mfc-l@netcom.com
> Subject: Compressing an Access MDB through ODBC
> Date: Wednesday, March 05, 1997 8:24 PM
> 
> Environment: VC++ 1.52c, Win 95
> 
> Does anyone know if it is possible, and if so, how to compact an Access
2.0 
> database (*.mdb) programmatically through ODBC? CDatabase does not
encapsulate 
> this functionality, but ODBC administrator does provide an option to
compact 
> an Access 2.0 database interactively, so the Access driver does seem to 
> include this functionality. I have scoured the ODBC 2.0 Programmer's
Reference 
> and SDK Guide, and my MSDN CD to no avail. Any suggestions?
> 
> Thanks.
> 
> Erik Thomas
> E.J.Thomas & Associates
> ErikThomas@msn.com
-----From: "Christian Studer" 

The Access 97 ODBC driver reference says to use the ODBC API function
SQLConfigDataSource. Quote: 'To perform data compaction on a database file
programmatically, include "COMPACT_DB=  "
in the list of attributes (lpszAttributes) of the SQLConfigDataSource
function. In this function,  is the full path to the Microsoft
Access database to be compacted and  is the full path for the
compacted Microsoft Access database'.
You can get to the driver reference by setting up a new Access ODBC data
source and pressing Help on the Setup dialog.

Hope this helps,
Christian

Visit http://www.access.ch/beautiful_star

> Does anyone know if it is possible, and if so, how to compact an Access
2.0 
> database (*.mdb) programmatically through ODBC? CDatabase does not
>encapsulate 
> this functionality, but ODBC administrator does provide an option to
compact 
> an Access 2.0 database interactively, so the Access driver does seem to 
> include this functionality.
-----From: hrubin@nyx.net (Howard Rubin)


Search MSDN for keywords SQLConfigDataSource and COMPACT_DB
gives a few references, notably article Q126606 which should
do exactly what you're looking for.
Howard Rubin.

>>
Environment: VC++ 1.52c, Win 95

Does anyone know if it is possible, and if so, how to compact an Access 2.0 
database (*.mdb) programmatically through ODBC? CDatabase does not encapsulate 
this functionality, but ODBC administrator does provide an option to compact 
an Access 2.0 database interactively, so the Access driver does seem to 
include this functionality. I have scoured the ODBC 2.0 Programmer's Reference 
and SDK Guide, and my MSDN CD to no avail. Any suggestions?

Thanks.

Erik Thomas
E.J.Thomas & Associates
ErikThomas@msn.com
<<
-----From: Ray Barley 

Here's an excerpt from the Jet Database Engine Programmer's Guide, topic
Creating .MDB Files Programmatically (found on MS Developer CD).
SQLConfigDataSource() is in the ODBC installer DLL (ODBCINST.DLL).
Include 

To programmatically perform data compaction on a database file, include
"COMPACT_DB=source db; dest db; sort order" in the list of attributes
(lpszAttributes) of the SQLConfigDataSource function. In this function,
source db is the full path to the Microsoft Access database to be
compacted and dest db is the full path for the compacted Microsoft
Access database. When compacting a password-protected file, a password
and user ID must be entered in the list of attributes for
SQLConfigDataSource.
This operation runs the standard Microsoft Access compaction process on
the database. The same process can be performed through the Setup dialog
box for a Microsoft Access data source, which is available from the
32-bit ODBC Control Panel.




>----------
>From: 	Erik Thomas[SMTP:ErikThomas@msn.com]
>Sent: 	Wednesday, March 05, 1997 9:24 PM
>To: 	mfc-l@netcom.com
>Subject: 	Compressing an Access MDB through ODBC
>
>Environment: VC++ 1.52c, Win 95
>
>Does anyone know if it is possible, and if so, how to compact an Access 2.0 
>database (*.mdb) programmatically through ODBC? CDatabase does not
>encapsulate 
>this functionality, but ODBC administrator does provide an option to compact 
>an Access 2.0 database interactively, so the Access driver does seem to 
>include this functionality. I have scoured the ODBC 2.0 Programmer's
>Reference 
>and SDK Guide, and my MSDN CD to no avail. Any suggestions?
>
>Thanks.
>
>Erik Thomas
>E.J.Thomas & Associates
>ErikThomas@msn.com
>
-----From: meftech 

Erik Thomas wrote:
> 
> Environment: VC++ 1.52c, Win 95
> 
> Does anyone know if it is possible, and if so, how to compact an Access 2.0
> database (*.mdb) programmatically through ODBC? CDatabase does not encapsulate
> this functionality, but ODBC administrator does provide an option to compact
> an Access 2.0 database interactively, so the Access driver does seem to
> include this functionality. I have scoured the ODBC 2.0 Programmer's Reference
> and SDK Guide, and my MSDN CD to no avail. Any suggestions?
> 
> Thanks.
> 
> Erik Thomas
> E.J.Thomas & Associates
> ErikThomas@msn.com
I just addressed this very problem.

The answer is no you cannot compress through ODBC. You can:
- Compress by running an MS Access macro from the Access command line.
- Compress by using DAO and the JET interface. This is the approach
  we used.




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