<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Ok, I have progressed a little bit.<br></div><div>You have to rename the section in the odbcinst.ini file. QGIS and ogr2ogr expects the section [SQL Server] and not [ODBC Driver 17 for SQL Server] as written by Microsoft package.</div><div><br></div><div>Then I can use ogr2ogr to connect to my database and convert some table with this:</div><div>ogr2ogr -f "ESRI Shapefile" "/tmp/Carto.vPole" "MSSQL:server=myserver;database=MyBase;uid=carto;pwd=*******;" -overwrite -sql "SELECT id, position FROM Carto.vPole"</div><div><br></div><div>Now I need to understand the SQL Server syntax, and understand why I have hieroglyphs in my text fields (encoding I presume...)</div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">Le ven. 16 nov. 2018 à 17:00, kimaidou <<a href="mailto:kimaidou@gmail.com">kimaidou@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi all,</div><div><br></div><div>I am trying to connect to a MSSQL server from a QGIS installed in a Linux Debian Jessie computer.</div><div>I have checked that the credentials are ok with the mssql-client from Microsoft:</div><div><br></div><div>mssql-cli -S myserver -U carto -P ******* -d MyBase</div><div><br></div><div>I installed the following packages from debian and Microsoft repos :<br></div><div><br>curl <a href="https://packages.microsoft.com/keys/microsoft.asc" 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" 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</div><div><br></div><div>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></div><div>Then try to list the databases, but I get this error</div><div><br></div><div>[unixODBC][Driver Manager]Can't open lib 'SQL Server' : file not found</div><div><br></div><div>I tested with <br></div><div><br></div>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></div><div dir="ltr"><br></div><div>So I checked /etc/odbcinst.ini which seems ok</div><div><br></div><div>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></div><div><br></div><div>Should I install more packages ?  Any help appreciated.</div><div><br></div><div>Regards,</div><div>Michaël<br></div><div><br></div></div></div></div></div></div></div>
</blockquote></div>