Microsoft Knowledge Base Email Alertz

(298145) - If you use the SQLConfigDataSource ODBC API call with the REPAIR_DB option on an encrypted Microsoft Access database file, the database is properly repaired, but the encryption is removed.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 298145 - Last Review: September 26, 2005 - Revision: 3.2

FIX: REPAIR_DB Option May Remove Encryption from Access 2000 Database

This article was previously published under Q298145

SYMPTOMS

If you use the SQLConfigDataSource ODBC API call with the REPAIR_DB option on an encrypted Microsoft Access database file, the database is properly repaired, but the encryption is removed.

CAUSE

This is a problem in the Microsoft Jet ODBC Drivers (Odbcjt32.dll) that ship with Microsoft Data Access Components (MDAC) 2.5 Service Pack 2 and earlier.

RESOLUTION

To resolve this problem, obtain the latest service pack for Microsoft MDAC 2.5. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
293312  (http://kbalertz.com/Feedback.aspx?kbNumber=293312/EN-US/ ) INFO: How to Obtain the Latest MDAC 2.5 Service Pack
The English version of this fix should have the following file attributes or later:
   Date        Version      Size            File name      Platform
   ----------------------------------------------------------------
   12/04/2001  4.0.7412.0   270,608 bytes   Odbcjt32.dll   x86
				

WORKAROUND

To work around this problem, use the CDaoWorkspace::RepairDatabase function to repair the database.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft MDAC 2.5 Service Pack 3.

MORE INFORMATION

The following code reproduces the problem:
void Repair(BOOL bEncrypt)
{
	CString strDBQ = "d:\\NWind.mdb", strSystemDB = "d:\\System.mdw";
	CString strAttributes;
	strAttributes += "REPAIR_DB=";
	strAttributes += strDBQ;
	if (bEncrypt)
		strAttributes += " ENCRYPT";  // This additional keyword is an optimistic try and has no effect!!
	strAttributes += "|";
	strAttributes += "SYSTEMDB=";
	strAttributes += strSystemDB;
	strAttributes += "|";
	strAttributes += "EXCLUSIVE=TRUE";
	strAttributes += "|";
	strAttributes += "|";

	// Exchange pipes against nulls so the command is interpreted correctly.
	for (int i = 0; i < strAttributes.GetLength(); i++)
	{
		if (strAttributes[i] == '|')
			strAttributes.SetAt(i, char(0));
	}

	BOOL b = SQLConfigDataSource(NULL, ODBC_CONFIG_SYS_DSN, "Microsoft Access Driver (*.mdb)",
		(LPCSTR) strAttributes);
	if (!b)
	{
		CString strErrorMsg;
		for (int i = 1; i <= 8; i++)
		{
			WORD cbErrorMsg;
			DWORD dwErrorCode;
			RETCODE r = SQLInstallerError(i, &dwErrorCode, strErrorMsg.GetBuffer(100), 100, &cbErrorMsg);
			if (r == SQL_NO_DATA)
				break;
			strErrorMsg.ReleaseBuffer(cbErrorMsg);
			TRACE("Rec: %d: %d, %x (%s)\n", i, r, dwErrorCode, (const char *) strErrorMsg);
		}

		AfxMessageBox("Repair failed!");
	}
	else
		AfxMessageBox("Repair succeeded!");
}
				

APPLIES TO
  • Microsoft Open Database Connectivity Driver for Access 4.0
  • Microsoft Data Access Components 2.1 Service Pack 2
  • Microsoft Data Access Components 2.5 Service Pack 2
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.5 Service Pack 1
Keywords: 
kbhotfixserver kbqfe kbmdac250sp3fix kbjet kbmdacnosweep kbprb KB298145
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate