[gdal-dev] Connection to SQL Server 2008

Christophe B ampouillle at gmail.com
Tue Apr 12 11:44:11 EDT 2011


Hello List,

We have encountered a problem on version 1.7 of QGIS (dev) can support the
connection to SQL Server 2008.

When it connects to the base layer does not contain any vector object and
the attribute table contains the correct columns and many rows, but they all
contain "ERROR" ...

Same problem on version 1.8 of GDAL :

When it connects to the base layer for export table to shapefile, error is :


Unable to open datasource
`MSSQL:server=.\SQLSERVER;database=ObservatoireCommerce;tables=dbo.T_
CommuneGeographie;trusted_connection=yes' with the fo
llowing drivers.

One of you has it managed to run this connection?

Thank you!

Christophe Baume

Code :

the sql table(2008) is defined as :

CREATE TABLE [dbo].[T_CommuneGeographie](

      [COMGEO_Id] [uniqueidentifier] ROWGUIDCOL  NOT NULL,

      [COMGEO_Commune_COM_Id] [uniqueidentifier] NOT NULL,

      [COMGEO_Geographie] [geography] NOT NULL,

      [COMGEO_DateDebut] [date] NULL,

      [COMGEO_DateFin] [date] NULL,

CONSTRAINT [PK_T_CommuneGeographie] PRIMARY KEY CLUSTERED

(

      [COMGEO_Id] ASC

)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF
, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

) ON [PRIMARY]



the lines entered into the console:


ogr2ogr -overwrite -f "ESRI Shapefile" "c:/test/test.shp"
"MSSQL:server=.\SQLSERVER;database=ObservatoireCommerce;tables=dbo.T_CommuneGeographie;trusted_connection=yes"

the lines entered into the python console:
conn_string =
"MSSQL:server=.\SQLExpress;database=ObservatoireCommerce;trusted_connection=yes;tables=dbo.T_CommuneGeographie"


qgis.utils.iface.addVectorLayer(conn_string,'test','ogr')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110412/4c4b8414/attachment.html


More information about the gdal-dev mailing list