[gdal-dev] OGR Can not connect to Oracle

Clay, Bruce bclay at ball.com
Tue Dec 18 14:18:52 EST 2007


I have used GDAL c/c++ in various projects to manipulate data in files
but now I am trying to use it with c# to connect to an Oracle database.
The code I used is show below.

 

            try

            {

                OSGeo.OGR.Ogr.RegisterAll();

                status = 0;

            }

            catch (Exception except)

            {

                string statusMsg = "Could not Initialize GDAL/OGR\n" +

                            "Make sure the libraries are properly
installed";

                MessageBox.Show(statusMsg);

            }

 

            if (status == 0)

            {

                try

                {

                    string connectString = "ODBC:Driver={Oracle in
OraHome92};

 
Server=host.domain.company.com;dbq=dbName;UID=userName;PWD=password";

                    DataSource ds = Ogr.Open(connectString, 0);

                }

                catch (Exception except)

                {

                    string statusMsg = "Could not open dataset" +
except.Message;

                    MessageBox.Show(statusMsg);

                }

            }

 

I am using the libraries included in FwTools2.0.3\csharp.

 

The registration works ok but the connection does not.  When I execute
the Open shown above the program goes out to lunch.  If I break in
Visual Studio the stack trace just shows "External Code".  I can use the
same connection string in a different c# (without the "ODBC:")
application that uses Microsoft's System.Data.Odbc OdbcConnection.

 

ogrInfo shows ODBC support is available although no direct OCI support
is listed.  No ArcSDE support is shown either not that I really want to
use it since it is sooooo slow.

 

I can not find any OGR examples that connect to Oracle.

 

I would rather use GDAL/OGR if possible so I can use the common feature
support across a variety of geo-datbases.

 

Does anyone have any clues what I might be doing wrong?

 

Bruce

 




This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20071218/3b743177/attachment.html


More information about the gdal-dev mailing list