[fdo-dev] Enumerating connection properties

Greg Boone greg.boone at autodesk.com
Mon Oct 23 18:09:51 EDT 2006


In FDO, some connection properties may be either enumerable while a
connection is closed while other connection properties may only be
enumerable once Open() has been called. This allows a caller to specify
a subset of the connection properties in order to find out the valid
values for the remaining properties. This behavior is defined by the
provider itself and allows a user to specify a subset of the connection
properties, connect and then request that the provider enumerate the
remaining connection property values. 

In FDO, we generally refer to this as a multi-stage connection process.
In these circumstances, Open() will succeed but the connection state is
not returned as 'Open'. Rather the connection state is returned as
'Pending'. This return state tells the user that more information is
required to complete the connection process. 

In Oracle, the user is able to specify the service, username and
password and then call Open(). Since the datastore property has not been
specified, the connection process in not complete and 'Pending' is
returned. The user may then enumerate the property values for the
datastore property. This action will cause the Provider to request this
information from the server. The generated list is then dynamically
returned to the caller. The caller may then specify a value from the
returned list as the final connection property and call Open() again.
This time the call succeeds with a state of 'Open'.

I hope this helps.....

Greg



-----Original Message-----
From: Mateusz Loskot [mailto:mateusz at loskot.net] 
Sent: Monday, October 23, 2006 5:37 PM
To: dev >> fdo-dev
Subject: [fdo-dev] Enumerating connection properties

Hi,

I'd like to ask for clarification of behavior of connection
properties API when using RDBMS provider, ie. existing OSGeo.MySQL3.2

The main question is:

Do I need to open a connection before I call
FdoIConnectionPropertyDictionary::EnumeratePropertyValues() ?

I believe I know the overall procedure in details,
but I'm not sure I understand how the EnumeratePropertyValues()
is expected to work.

I CreateConnection(), next GetConnectionInfo() and finall fetch
properties using GetConnectionProperties().
Now, I loop through properties and check if given every property
IsPropertyEnumerable() and if it is, then I call
EnumeratePropertyValues() to fetch
a) number of enumerable values of partibular property and
b) pointer to array, if there are any elements available

Note, that I have not called Open() to open connection yet.

Now, the problem is every time I call EnumeratePropertyValues()
(for property that is enumerable) following exception is thrown:

"Connection not established"


I tracked the call chain and for RDBMS provider, the exception is thrown
from FdoRdbmsConnectionPropertyDictionary::EnumeratePropertyValues()
In lines 37-38, following condition is FALSE:

if((mConnection == NULL)
   || (mConnection->GetConnectionState() == FdoConnectionState_Closed))
     throw FdoCommandException::Create(NlsMsgGet(FDORDBMS_13,
                                "Connection not established"));

I don't understand why EnumeratePropertyValues() expects the connection
has been established. According to FDO Dev Guide, the Open() action is
executed in Step 5 (Page 37) and looping connection properties, not
before.

Am I missing something?

p.s. Please, if my question is not clear or unanswerable,
I'd appreciate a note about it, then I will have a chance to explain
it clearer.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe at fdo.osgeo.org
For additional commands, e-mail: dev-help at fdo.osgeo.org






More information about the Fdo-internals mailing list