<div dir="ltr"><div>Hi Nyall, <br></div><div><br></div><div>Thanks for your answer. I had already checked that the layers had integer primary keys. I have discovered that the "wrong" layers had "nvarchar" fields, instead of "varchar". We changed the types of the view fields from nvarchar to varchar, and it solved the issue.</div><div><br></div><div>Cheers,</div><div>Michaël<br></div></div><br><div class="gmail_quote"><div dir="ltr">Le mer. 5 déc. 2018 à 23:55, Nyall Dawson <<a href="mailto:nyall.dawson@gmail.com">nyall.dawson@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, 6 Dec 2018 at 05:37, kimaidou <<a href="mailto:kimaidou@gmail.com" target="_blank">kimaidou@gmail.com</a>> wrote:<br>
><br>
> Thanks for your answers. I managed to connect with QGIS MSSQL native provider under my Debian box with the following steps<br>
> <a href="https://gist.github.com/mdouchin/64f7733a3c4ecfe441f65d5529351a30" rel="noreferrer" target="_blank">https://gist.github.com/mdouchin/64f7733a3c4ecfe441f65d5529351a30</a><br>
><br>
> I have a weird behaviour. For some layers, QGIS Desktop cannot display the features attributes : the attribute table is empty, and the identify tool returns no feature. BUT I can see the points in my map, so QGIS can query the geography field from the database. For some other layers, wich seems identical (same structure for example), I can see the attributes (full attribute table and identify OK)<br>
><br>
<br>
Sounds like an issue with fetching by primary key/feature ID. Is there<br>
any difference between the primary key setup on these tables vs the<br>
ones which work?<br>
<br>
Nyall<br>
<br>
<br>
<br>
<br>
> Have anyone seen this behaviour before ?<br>
><br>
> Cheers<br>
> Michaël<br>
><br>
> Le lun. 19 nov. 2018 à 00:12, Nyall Dawson <<a href="mailto:nyall.dawson@gmail.com" target="_blank">nyall.dawson@gmail.com</a>> a écrit :<br>
>><br>
>> On Sat, 17 Nov 2018 at 02:01, kimaidou <<a href="mailto:kimaidou@gmail.com" target="_blank">kimaidou@gmail.com</a>> wrote:<br>
>> ><br>
>> > Hi all,<br>
>> ><br>
>> > I am trying to connect to a MSSQL server from a QGIS installed in a Linux Debian Jessie computer.<br>
>> > I have checked that the credentials are ok with the mssql-client from Microsoft:<br>
>> ><br>
>> > mssql-cli -S myserver -U carto -P ******* -d MyBase<br>
>> ><br>
>> > I installed the following packages from debian and Microsoft repos :<br>
>> ><br>
>> > curl <a href="https://packages.microsoft.com/keys/microsoft.asc" rel="noreferrer" target="_blank">https://packages.microsoft.com/keys/microsoft.asc</a> | apt-key add -<br>
>> > curl <a href="https://packages.microsoft.com/config/debian/8/prod.list" rel="noreferrer" target="_blank">https://packages.microsoft.com/config/debian/8/prod.list</a>  > /etc/apt/sources.list.d/mssql-release.list<br>
>> > apt-get update<br>
>> > ACCEPT_EULA=Y apt-get install -y mssql-cli unixodbc-dev mssql-tools msodbcsql17 msodbcsql odbcinst libqt4-sql-tds libqt4-sql-odbc<br>
>> ><br>
>> > When I open QGIS and try to set up a connection, I use not DSN, and I put my server "myserver" as the host. I add the user and password.<br>
>> > Then try to list the databases, but I get this error<br>
>> ><br>
>> > [unixODBC][Driver Manager]Can't open lib 'SQL Server' : file not found<br>
>><br>
>> This is all super-fragile. (Just another symptom of SQL Server's<br>
>> inferiority IMO).<br>
>><br>
>> Have a look at <a href="https://github.com/qgis/QGIS/blob/master/.ci/travis/linux/docker-build-test.sh#L128" rel="noreferrer" target="_blank">https://github.com/qgis/QGIS/blob/master/.ci/travis/linux/docker-build-test.sh#L128</a><br>
>> for how the Travis testing environment sets up a connection, there may<br>
>> be some clues there.<br>
>><br>
>> Nyall<br>
>><br>
>> ><br>
>> > I tested with<br>
>> ><br>
>> > root@carto:~# odbcinst -j<br>
>> > unixODBC 2.3.1<br>
>> > DRIVERS............: /etc/odbcinst.ini<br>
>> > SYSTEM DATA SOURCES: /etc/odbc.ini<br>
>> > FILE DATA SOURCES..: /etc/ODBCDataSources<br>
>> > USER DATA SOURCES..: /root/.odbc.ini<br>
>> > SQLULEN Size.......: 8<br>
>> > SQLLEN Size........: 8<br>
>> > SQLSETPOSIROW Size.: 8<br>
>> ><br>
>> > So I checked /etc/odbcinst.ini which seems ok<br>
>> ><br>
>> > root@carto:~# cat /etc/odbcinst.ini<br>
>> > [ODBC Driver 17 for SQL Server]<br>
>> > Description=Microsoft ODBC Driver 17 for SQL Server<br>
>> > Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.2.so.0.1<br>
>> > UsageCount=1<br>
>> ><br>
>> > [ODBC Driver 13 for SQL Server]<br>
>> > Description=Microsoft ODBC Driver 13 for SQL Server<br>
>> > Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2<br>
>> > UsageCount=1<br>
>> ><br>
>> > Should I install more packages ?  Any help appreciated.<br>
>> ><br>
>> > Regards,<br>
>> > Michaël<br>
>> ><br>
>> > _______________________________________________<br>
>> > QGIS-Developer mailing list<br>
>> > <a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
>> > List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>> > Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>