Does anybody knows if there is the ability to check a layers datasource, if it is an direct connect to a database or if an ArcSDE service is used?

For both the esriDataSourcesGDB.SdeWorkspaceFactory is used. Maybe there is a interface?

  • There's two issues here: 1) Why does it matter? 2) Application service connections are deprecated, so all connections will eventually be direct. The connection type is not a property, so that means extracting the connection properties and parsing the instance parameter. – Vince Sep 14 '15 at 13:16
  • The only time I need to know this is when issuing log statements in my code--it can really speed up troubleshooting down the line (especially when clients have the option of connecting with either option). Admittedly,it's probably been 5+ years since I've coded for one of these environments. – Jay Cummins Sep 14 '15 at 13:56
  • We need this information because we want to publish data from a geodatabase in oracle via UMN Mapserver. In time the Mapserver only can show data from such a geodatabase served in an ArcSDE-Layer. – Ms. Smith Sep 15 '15 at 6:44

As Vince mentioned in his comment, you have to parse the connection properties.

A quick google search on: IsDirectConnect and filetype:cs https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&es_th=1&ie=UTF-8#q=IsDirectConnect+filetype%3Acs&es_th=1 reveals an example that you can build on: ftp://ftp.leesburgflorida.gov/gis/Telvent/Custom%20Code/Leesburg_10.1/Miner/Miner.ATeam/WorkspaceHelper.cs

public static bool IsDirectConnect(string instance)
    return Regex.IsMatch(instance.ToString().ToLower(),
                        | RegexOptions.Singleline
                        | RegexOptions.CultureInvariant
                        | RegexOptions.IgnorePatternWhitespace);


Obviously, you would update this with current rdbms versions (and maybe add postgres if that's what you are using). It's a typical approach.

  • 1
    Matching "^sde:" is enough (and then you're not RDBMS dependent). – Vince Sep 14 '15 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.