7th July 01:09
Implementing provider with ATL
I'm trying to implement an OLE DB provider by using the ATL
template provider. However, I'm having a difficult time
with getting the parameters where I need them. Warning -
I'm pretty novice in OLE DB. Sorry if I'm completely off track.
The way I understand this, the templates do most of the
framework for me. One of the things the templates do for me
is to create the relation between the datasource and the
If I understand this correctly, I need to create the
connection to the database when the session object is
created. The only overrideable function I seem to have at
this stage, however, is the session's constructor. If I try
to create a connection from the constructor, I find that I
don't have enough information to do so.
All the properties needed for knowing where to establish
the connection to were set at the data source level. I
tried using the "GetDatasource" function to get to the
properties interface and query all the relevant properties.
That does not work. It seems that IGetDataSource is only
initialized after the constructor finished working. I could
not find any hook or callback that worked late enough for
me to use.
I'm contemplating dumping the code in the ATL template
completely, and using a non-default constructor to pass the
relevant properties. This means I do "new" directly on the
class, which I'm not sure I'm allowed.
Does anyone have any insights about what is the proper way
to do this? Doesn't the session ALWAYS need information
only available in the data source?