How to set up a MapInfo DBMS table from SQL Server without a DSN

A quick note to say that it is definitely possible to use a SQL Server spatial table in MapInfo Professional without an ODBC DSN. There's not much about this on the web, and the normal methods of opening SQL Server tables all seem to want a DSN. Here's a resulting .TAB file (this assumes you have the table or view configured in the MAPINFO.MAPINFO_MAPCATALOG table):

 

!table
!version 1000
!charset WindowsLatin1

Definition Table
  Type ODBC
begin_metadata
"\IsReadOnly" = "FALSE"
"\MapInfo" = ""
"\MapInfo\TableID" = "2e88f9e5-7d4c-4645-b824-4ef6b5102c9e"
"\DATALINK" = ""
"\DATALINK\Query" = "Select *  From ""myDatabase"".""dbo"".""myTableOrView"""
"\DATALINK\ConnectionString" = "Description=aDescription;DRIVER=SQL Server;SERVER=myServer;Trusted_Connection=Yes;APP=MapInfo Professional®;WSID=blah;DATABASE=myDatabase"
"\DATALINK\ToolKit" = "ODBC"
"\CACHE" = "OFF"
"\MBRSEARCH" = "ON"
end_metadata

Comments

re: How to set up a MapInfo DBMS table from SQL Server without a DSN

23 January 2018

If you are following the above template and receive an error similar to below, try change DRIVER=SQL Server to DRIVER=SQL Native Client.

Error encountered: 

---------------------------
Microsoft SQL Server Login
---------------------------
Connection failed:
SQLState: '01000'
SQL Server Error: 14
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Invalid Instance()).
Connection failed:
SQLState: '08001'
SQL Server Error: 14
[Microsoft][ODBC SQL Server Driver][DBNETLIB]Invalid connection.

---------------------------
OK   
---------------------------
 

Find out more