C++ Access to SQL Server from Linux

后端 未结 2 583
甜味超标
甜味超标 2021-02-07 19:08

I need to write some data to SQL Server database from Linux in C++.

I found this sqlapi.com

But I think, at first ODBC driver has to be installe

2条回答
  •  梦毁少年i
    2021-02-07 19:44

    Here are the links I bookmarked concerning that topic, hope it can help you:

    • ODBC Tutorial
    • FreeTDS
    • Connection strings
    • How to configure ODBC - This one was really useful.

    It was some time ago, but basically what I remember is:

    You have to create an entry for the particular MSSQL driver you have in a file named /etc/odbcinst.ini. Then, for each MSSQL server, you have to create an entry (or DSN), either globaly in /etc/odbc.ini, or user-local, in $HOME/.odbc.ini.

    Some names I used might differ (and I don't have acces to my Linux box right now to check) but you got the general idea.

    Once you did that, isql -d should connect succesfully to the database. If so, then using the C/Linux API for ODBC should be a piece of cake. Tutorials provided in the given links.

提交回复
热议问题