Mac & Ms SQL???

Hello,
I imagine this has been asked before but I can’t find it. Is it possible to somehow connect to MS SQL from a Mac application? I can’t figure out how, is there a specific plugin I should be using? or are there ODBC drivers for that? I must say I am very new to the mac.
Help…

Yup.

http://www.actualtech.com/product_sqlserver.php

You can use our MBS SQL Plugin with freetds library to connect to MS SQL Server from Mac or Linux.

Is there a compiled version of that library available (For OSX, I’m not finding it here : freetds ) and do you have example code on how to use it with MBS SQL Plugin?

I put a Mac library here:
http://www.macsw.de/plugin/Libs/

and where can i get the freedts library from?? Christian?

You can build your own copy or try the one i just uploaded. See above.

assume i need to put this on the plugin folder??? together with the MBS SQL Plugin? I assume i don’t need anything extra for Windows version.

[quote=29526:@Christian Schmitz]I put a Mac library here:
http://www.macsw.de/plugin/Libs/[/quote]
Okay, so we have now this file ‘libtdsodbc.dylib’ which seems to be a free ODBC driver for MS SQLServer.

I tried to install that driver using iODBC Administrator, but the heck: it turns out that one will spend hours or more to figure out how to configure it, how to make it run, etc. - Forget it and tell your clients to go with the Actual ODBC driver. They will be able to manage it - unlike the ‘free’ stuff.

Well, the dylib from me is stand alone. You tell our SQL plugin to load this dylib and connect. No configuration needed.

and how do i ask the MBS SQL Plugin to load this??

For what it’s worth, I used the Actual Tech ODBC driver for years without a hitch in my previous job. They do regular updates and are very responsive if you have a question.

Like this:

[code] dim Libfile as FolderItem = SpecialFolder.Desktop.Child(“libtdsodbc.dylib”)

con.SetFileOption("ODBC.LIBS", libfile)
con.Connect(TextField1.text,"","",SQLConnectionMBS.kODBCClient)

[/code]

That’s with SQLConnectionMBS class. But SQLDatabaseMBS works similar.

thanks…

I tried it on Mavericks with Christians build off FreeDTS, but i get always:

08001 [FreeTDS][SQL Server]Unable to connect to data source

The libtdsodbc.dylib is on my Desktop and i use the following Code:

dim Libfile as FolderItem = SpecialFolder.Desktop.Child("libtdsodbc.dylib") WaWiConnection.SetFileOption("ODBC.LIBS", libfile) WaWiConnection.Connect("Driver={FREETDS};Server=192.168.98.31;Database=SL_MARCHE", WaWi_Login, WaWi_Password, SQLConnectionMBS.kODBCClient)

On Windows 7 it works fine with:

WaWiConnection.Connect("192.168.98.31@SL_MARCHE", WaWi_Login, WaWi_Password, SQLConnectionMBS.kSQLServerClient))

Nothing seems to work :frowning:

is that with my plugin?
Did you see examples?

by the way, i use the actualODBC on my mac and this code for a DSN-less connection

Dim db As New ODBCDatabase

db.DataSource = “DRIVER=/Library/ODBC/Actual SQL Server.bundle/Contents/MacOS/atsqlsrv.so;Server=192.168.0.3;
Database=test;UID=username;PWD=password;”

no pre-configuration by the user needed.

For me I had to first enable TCP/IP on the server, open firewall and make sure the Server uses right IP. Because if you can’t connect via telnet to that IP on port 1433, it’s not running as it should be.

your right Christian,

also it depend if you use the express (free version of MSsql) i think it had tcp/ip disabled by default and you have to use the server administrator to enable it.

also, sometimes you need to specify the server as 192.168.0.3\sqlexpress in order to connect to an ‘instance’ depending on how it is installed. i believe just connecting to the ip, actually you are connecting to ip.ad.dr.ess\mssqlserver,
this instance is implied if you miss it off

I got it working after putting port 1433 everywhere in the IP configuration instead of a dynamic port.

My code is like this:

[code] // preload libs, this helps on Linux to find them
dim libtdsodbc as Folderitem = GetFolderItem(“libtdsodbc.dylib”)

dim s as new SoftDeclareMBS
call s.LoadLibrary(libtdsodbc.UnixPathMBS)

// connect
dim con as new SQLConnectionMBS

try

// we used Microsoft SQL Server 2008 and run app on Windows to test this

dim cs as string = "DRIVER={FREETDS};Server="+iServer.Text+";UId="+iUser.Text+";PWD="+iPass.Text+";Database="+iDatabaseName.Text+";TDS_VERSION=7.2;Port="+iPort.text

con.SetFileOption con.kOptionLibraryODBC, libtdsodbc
con.Option("UseAPI") = "ODBC" 
con.Connect(cs,"","",SQLConnectionMBS.kODBCClient)

[/code]