Showing posts with label oledb. Show all posts
Showing posts with label oledb. Show all posts

Wednesday, March 28, 2012

Loosing database connection when device power-off (native oledb code)

Hi,

I experienced this problems on both Windows Mobile 2003 SE and Windows Mobile 5.0.

Its native development (c++, oledb, atl and mfc).

It's quite simple to reproduce...

1. open a database

2. open a rowset on table A (whatever, valid of course and with both IOpenRowset and ICommandText), read datas and close rowset

3. power off

4. power on

5. try step 2 with another table (failed on openrowset with error 0x80004005) or try table A (sometimes working because of cached memory, sometims failed on Read Datas).

6. being stuck ;-)

Our work-around was, in case we loose our connection (identified by error 0x80004005 on openrowset), we close it and re-open database... ugly for sure, but working.

What I'm looking now is to use some kind of "detection method" like what people in .Net develoment are using "if ConnectionState.Open <> ...) for reopening my database only on demand...

Thanks in advance for any hints,
Fabien.

Your application should detect device going standby, closing connection which should be reestablished upon power up.

You've already found similar solution, you might as well continue doing that instead of making your application power state aware.

Note: that usually happens if database is on removable storage card.

|||

Thanks for your answer.

You're right about the removable storage card (both using SD and CF on X50/X51).

Have you any hint how to detect device going stand by and how to detect power up ?

Is it normal notifications or should I implement an OleDB interface ?

Regards,

Thanks,
Fabien.

|||

This might be of help:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceddk5/html/wce50lrfrequestpowernotifications.asp

|||

Thanks a lot.

I'm just afraid that I've no other ways to go if I want to make my application Power aware ;-)

I had read those articles before.

In the meantime, my work-around seems to work so far, so I already won 10 days to implement the power features with no pressure.

I'm just sad that DBCONNECTION_STATUS is not implemented.

Again, thanks for your tips.

Monday, March 12, 2012

Lookup and OLEDB Command components programming

I need some help on SSIS programming. Can anybody give me a short example or tutorial how to write a code, which will show me use of "Lookup" and "OLEDB Command" components?Here's an example of using a Lookup (amongst other things): http://www.sqlis.com/default.aspx?311

The SCD Wizard produces a data-flow with an OLE DB Command in it so you could look at that!

-Jamie|||And how can I get a code from SCD Wizard?|||

Erch wrote:

And how can I get a code from SCD Wizard?

You can't. The SCD Wizard produces components, not code.

So am I correct in saying that you want to build a package programatically that contains a data-flow containing a LOOKUP and an OLE DB COMMAND? There isn't much resources around yet that shows how to do this - BOL is definately the best place to go.

-Jamie