[gdal-dev] Ogr to access MSSQL DB

Benjamin benjamin.lux at maxsea.fr
Wed Jul 11 03:32:46 PDT 2012


I try to connect my application to a DB with the framework Ogr (with C#
When I write folloing code, Ogr methods view the DB but can't read it.


            const string connectionString =

            DataSource pnn3 = Ogr.Open("MSSQL:" + connectionString, 0);
            if (pnn3 == null)
                       throw new IOException("Creation of output file
            Console.WriteLine("pnn3.Name\t=" + pnn3.name);
            Console.WriteLine("pnn3.GetLayerCount()\t= " +

It display :

I know my DB is view because if I switch SERVEUR_NAME and/or DATABASE_NAME
by an other name the exception is throwed
On the other hand driver don't see my layers (it displays 0, and my db has
near to 30 layers).

If someone have already connected to db MSSQL, can him suggests me an
example of code (in C or C++ it is also great, it may help me) ?

I use gdal-1.9.0 (with MSSQL Driver)
link usefull :  http://www.gdal.org/ogr/drv_mssqlspatial.html MSSQLSpatial -
Microsoft SQL Server Spatial Database 

Best regards,

View this message in context: http://osgeo-org.1560.n6.nabble.com/gdal-dev-Ogr-to-access-MSSQL-DB-tp4987592.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120711/d4a7c24f/attachment-0001.html>

More information about the gdal-dev mailing list