Newbie's First FDO App

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Newbie's First FDO App

damitch
I'm new to OsGeo FDO.  I've been pursuing some computer programming as a hobby, but without much formal schooling in it.  I see a lot of potential in improving how we update our GIS information at work - in 'real life', I'm a Civil Engineer for the Public Works Department of Long Beach, California.  I've been pretty confused by such tools as seem to be available through ESRI and AutoCAD.
 
As a start, I'd like to try using OsGeo FDO to connect to an MS Access database.  After I get an FDO connection going, I should be able to extract other data and manipulate it so it can be exported to FDO files - perhaps?
 
I see that there are C# libraries available, and I think (maybe) that I can work with those.  So first things first - my first simple code is:
 
using System;
namespace CmdLineTestFDO
{
 class Program
 {
  public static void Main(string[] args)
  {
   Console.WriteLine("Hello World!");
   OSGeo.FDO.IConnectionManager conmgr = OSGeo.FDO.ClientServices.FeatureAccessManager.GetConnectionManager();
   OSGeo.FDO.Connections.IConnection connect = conmgr.CreateConnection("OSGeo.ODBC.3.4");
   connect.ConnectionString = "DSN=###;"; // intentionally goofy for this test
   OSGeo.FDO.Connections.ConnectionState state = connect.Open();
   if (state == OSGeo.FDO.Connections.ConnectionState.ConnectionState_Open) {
    Console.WriteLine("Impossible");
   }
   else Console.WriteLine("Got this far at least");
   Console.Write("Press any key to continue . . . ");
   Console.ReadKey(true);
  }
 }
}
 
In the spirit of open source, I'm using the SharpDevelop 3.2 software development environment program.  It's worked with other small apps I've tried, including one with ObjectARX 2010, and I can't afford the cost of MS Developer Studio.  I tried starting with OsGeo FDO version 3.4.1 because I figured that for starting out, an older tested version might be better.  The above compiled without problems.
 
Results:
 
H:\DotNetProjects\CmdLineTestFDO\bin\Debug>cmdlinetestfdo
Hello World!
Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at FdoFeatureAccessManager.GetConnectionManager()
   at OSGeo.FDO.ClientServices.FeatureAccessManager.GetConnectionManager() in e:\opensource_fdo_34\fdo\managed\src\osgeo\fdo\clientservices\mgfeatureaccessmanager.cpp:line 32
   at CmdLineTestFDO.Program.Main(String[] args) in g:\DotNetProjects\CmdLineTestFDO\Program.cs:line 18
H:\DotNetProjects\CmdLineTestFDO\bin\Debug>
 
What's wrong here?  Thanks for any advice.
 

_______________________________________________
fdo-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie's First FDO App

Jackie Ng
The first thing to understand is that FDO is a C++ library. Though you are using .net, those OSGeo.FDO.*.dll assemblies are nothing more than wrappers to the underlying unmanaged binaries. Your FDO assemblies will throw all kinds of errors like the one you mentioned if the unmanaged binaries are not in the same location

So you need to ensure that *all* the files from your FDO bin directory are copied to your output directory. You should be able to do this as a post-build step in both Visual Studio and SharpDevelop.

- Jackie
Reply | Threaded
Open this post in threaded view
|

Re: Newbie's First FDO App

lifan-tg
This post has NOT been accepted by the mailing list yet.
Hi Jackie,

I got the same exception when I complete build fdo 3.7 using gdal 1.9. When I call FdoFeatureAccessManager.GetConnectionManager()

Any ideas?

James