[mapguide-users] Re: Creating an ODBC feature source dynamically

sanpet osgeo at fig-tech.com
Sat Dec 11 17:49:52 EST 2010



I have figured out how to do this now, thanks to Jackie's suggestion.

For the benefit of others who might want to do this, I got the configuration
document this way:

Connect manually in Studio, setting the table etc.
Using the API, get the content of the MgByteReader object (an XML) returned
by ResourceService.GetResourceData(<TheResourceIdentifier>,"config"). I used
"config" as the second parameter because this is what is also in the
FeatureSource XML. I guess this is always the default string.

I open the XML got above in an editor and stripped out all the tables I
don't require.

The modified XML is now used as the configuration XML to create a ByteSource
and a data ByteReader which I used with SetResourceData() thus:
               MgByteSource bSrc = new MgByteSource(<Modified XML file>);
               MgByteReader configData = bSrc.GetReader();
               ResourceService.SetResourceData(resourceID, "config",
"Stream", configData);
               bool connected = FeatureService.TestConnection(resourceID);
  I am not sure if the last statement is necessary, but the documentation
seems to suggest that it is.

Once again, thanks Jackie.



-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Creating-an-ODBC-feature-source-dynamically-tp5824885p5827017.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list