Showing posts with label ole. Show all posts
Showing posts with label ole. Show all posts

Wednesday, March 7, 2012

Compact Sql Mobile 3.0 DataBase in C++/OLE DB ?

Hello,

I'm porting my C++ (EVC3) application from Sql CE 2.0 to Sql Mobile 3.0

(with OLE DB). To compact a 2.0 database, i used ISSCECompact interface.

But it doesn't exists with the new version. I've only found C#

and VB.Net samples in MSDN ...

Thanks in advance.

Have you had a chance to look at: http://msdn2.microsoft.com/en-us/library/ms174034(en-US,SQL.90).aspx

Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

|||

#include "ca_merge30.h"
#include <stdio.h>

void ErrorPrint() ;

#define VerifyResult(x) hr=x;\
if(FAILED(hr)) { \
printf("Failed : HR : %x\n",hr); \
printf("at : %d \n",__LINE__); \
ErrorPrint(); \
goto Exit; \
}
#define RELEASE(x) if(NULL!=x)x->Release();

extern "C" int __cdecl wmain(){

HRESULT hr = NOERROR;
ISSCEEngine *pISSCEEngine = NULL;
VerifyResult(CoInitialize(NULL));
VerifyResult(CoCreateInstance(CLSID_Engine, NULL, CLSCTX_INPROC_SERVER,
IID_ISSCEEngine, (void**)&pISSCEEngine));

WCHAR *wszSrc=L"Data Source = src.sdf";
WCHAR *wszDst=L"Data Source = dst.sdf";
VerifyResult(pISSCEEngine->CompactDatabase(wszSrc, wszDst));


Exit:
RELEASE(pISSCEEngine);
CoUninitialize();
return hr;
}

void ErrorPrint()
{
LPVOID lpMsgBuf;
DWORD dw = GetLastError();

FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL );

printf( "Failed with error %d: %ls",
dw, lpMsgBuf);

LocalFree(lpMsgBuf);
}

Hope this helps! Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

(Sample By: BalaDutt, MSFT, SQL Mobile, Microsoft Corporation)

|||Many thanks ! It's exactly what i needed !|||

Glad that I could help you.

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||

This helped me as well, thanks. But I also cannot find any reference material for how to perform a "Verify" DB as advertised in the Documentation for SQL Server Mobile Edition.

The docs have a sample in C#, but nothing for OLD DB in C++.

Does anyone know how to do this?

Compact Sql Mobile 3.0 DataBase in C++/OLE DB ?

Hello,

I'm porting my C++ (EVC3) application from Sql CE 2.0 to Sql Mobile 3.0 (with OLE DB). To compact a 2.0 database, i used ISSCECompact interface. But it doesn't exists with the new version. I've only found C# and VB.Net samples in MSDN ...

Thanks in advance.

Have you had a chance to look at: http://msdn2.microsoft.com/en-us/library/ms174034(en-US,SQL.90).aspx

Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

|||

#include "ca_merge30.h"
#include <stdio.h>

void ErrorPrint() ;

#define VerifyResult(x) hr=x;\
if(FAILED(hr)) { \
printf("Failed : HR : %x\n",hr); \
printf("at : %d \n",__LINE__); \
ErrorPrint(); \
goto Exit; \
}
#define RELEASE(x) if(NULL!=x)x->Release();

extern "C" int __cdecl wmain(){

HRESULT hr = NOERROR;
ISSCEEngine *pISSCEEngine = NULL;
VerifyResult(CoInitialize(NULL));
VerifyResult(CoCreateInstance(CLSID_Engine, NULL, CLSCTX_INPROC_SERVER,
IID_ISSCEEngine, (void**)&pISSCEEngine));

WCHAR *wszSrc=L"Data Source = src.sdf";
WCHAR *wszDst=L"Data Source = dst.sdf";
VerifyResult(pISSCEEngine->CompactDatabase(wszSrc, wszDst));


Exit:
RELEASE(pISSCEEngine);
CoUninitialize();
return hr;
}

void ErrorPrint()
{
LPVOID lpMsgBuf;
DWORD dw = GetLastError();

FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL );

printf( "Failed with error %d: %ls",
dw, lpMsgBuf);

LocalFree(lpMsgBuf);
}

Hope this helps! Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

(Sample By: BalaDutt, MSFT, SQL Mobile, Microsoft Corporation)

|||Many thanks ! It's exactly what i needed !
|||

Glad that I could help you.

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||

This helped me as well, thanks. But I also cannot find any reference material for how to perform a "Verify" DB as advertised in the Documentation for SQL Server Mobile Edition.

The docs have a sample in C#, but nothing for OLD DB in C++.

Does anyone know how to do this?

Compact Sql Mobile 3.0 DataBase in C++/OLE DB ?

Hello,

I'm porting my C++ (EVC3) application from Sql CE 2.0 to Sql Mobile 3.0 (with OLE DB). To compact a 2.0 database, i used ISSCECompact interface. But it doesn't exists with the new version. I've only found C# and VB.Net samples in MSDN ...

Thanks in advance.

Have you had a chance to look at: http://msdn2.microsoft.com/en-us/library/ms174034(en-US,SQL.90).aspx

Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

|||

#include "ca_merge30.h"
#include <stdio.h>

void ErrorPrint() ;

#define VerifyResult(x) hr=x;\
if(FAILED(hr)) { \
printf("Failed : HR : %x\n",hr); \
printf("at : %d \n",__LINE__); \
ErrorPrint(); \
goto Exit; \
}
#define RELEASE(x) if(NULL!=x)x->Release();

extern "C" int __cdecl wmain(){

HRESULT hr = NOERROR;
ISSCEEngine *pISSCEEngine = NULL;
VerifyResult(CoInitialize(NULL));
VerifyResult(CoCreateInstance(CLSID_Engine, NULL, CLSCTX_INPROC_SERVER,
IID_ISSCEEngine, (void**)&pISSCEEngine));

WCHAR *wszSrc=L"Data Source = src.sdf";
WCHAR *wszDst=L"Data Source = dst.sdf";
VerifyResult(pISSCEEngine->CompactDatabase(wszSrc, wszDst));


Exit:
RELEASE(pISSCEEngine);
CoUninitialize();
return hr;
}

void ErrorPrint()
{
LPVOID lpMsgBuf;
DWORD dw = GetLastError();

FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL );

printf( "Failed with error %d: %ls",
dw, lpMsgBuf);

LocalFree(lpMsgBuf);
}

Hope this helps! Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

(Sample By: BalaDutt, MSFT, SQL Mobile, Microsoft Corporation)

|||Many thanks ! It's exactly what i needed !
|||

Glad that I could help you.

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||

This helped me as well, thanks. But I also cannot find any reference material for how to perform a "Verify" DB as advertised in the Documentation for SQL Server Mobile Edition.

The docs have a sample in C#, but nothing for OLD DB in C++.

Does anyone know how to do this?

Saturday, February 25, 2012

Communication link failure

I am running an SSIS packsge across 2 servers. There at 33 Mil rows being copied over. At 5.6 mil rows I get this

[OLE DB Source [1]] Error: An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available.Source: "Microsoft SQL Native Client"Hresult: 0x80004005Description: "Protocol error in TDS stream". An OLE DB record is available.Source: "Microsoft SQL Native Client"Hresult: 0x80004005Description: "Communication link failure". An OLE DB record is available.Source: "Microsoft SQL Native Client"Hresult: 0x80004005Description: "TCP Provider: An existing connection was forcibly closed by the remote host. ". An OLE DB record is available.Source: "Microsoft SQL Native Client"Hresult: 0x80004005Description: "Communication link failure". An OLE DB record is available.Source: "Microsoft SQL Native Client"Hresult: 0x80004005Description: "TCP Provider: An existing connection was forcibly closed by the remote host. ". An OLE DB record is available.Source: "Microsoft SQL Native Client"Hresult: 0x80004005Description: "Communication link failure". An OLE DB record is available.Source: "Microsoft SQL Native Client"Hresult: 0x80004005Description: "TCP Provider: The specified network name is no longer available. ".

[DTS.Pipeline] Error: The PrimeOutput method on component "OLE DB Source" (1) returned error code 0xC0202009. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.

Is there any known cause of this?

Thanks

Looks like a connection problem and that something, somewhere starts to drop packets or even the connection. You might have to enlist the help of the network guys if such people exist where you're at.

Sunday, February 19, 2012

Commit Interval in OLE DB Driver

Hi,

I am trying to develop a custom destination component. Is there a way to enable transaction / commit interval in OLE DB drivers?

Thanks,

Vipul

I would say this has to be built into the OLE-DB provider itself. You should then be able to set the value, and would expect it to be a documented property of the provider.

Saying that this is a feature I associate with bulk interfaces, which are not OLE-DB providers themselves, so is it a feature of the OLE-DB specification?