Accessing Microsoft SQL Database from Mac/Linux
28 08 10 - 12:10 from wikipedia: FreeTDS is a free software programming library, a re-implementation of the Tabular Data Stream protocol. It can be used in place of Sybase's db-lib or ct-lib libraries. It also includes an ODBC library. It allows many open source applications such as Perl and PHP (or any C or C++ program) to connect to Sybase ASE or Microsoft SQL Server.Now you can use our SQL Plugin with FreeTDS to connect to a Microsoft SQL Server. Be aware that you need the freetds library with the odbc support compiled in. You can install this on Mac using ports like this: sudo port -d install freeTDS +mssql +odbc
sudo port install unixODBC
cd /opt/local/etc
sudo nano tds.driver.template
---
[FreeTDS]
Description = v0.64 with protocol v8.0
Driver = /opt/local/lib/libtdsodbc.so
---
sudo odbcinst -i -d -f tds.driver.template
sudo nano tds.datasource.template
---
[Winline_DB]
Driver = FreeTDS
Description = My Database
Trace = No
Server = 192.168.1.100
Port = 1433
Database = MyDatabase
---
odbcinst -i -s -f tds.datasource.template
isql -v Winline_DB sa pass
in REAL Studio you use our SQLConnectionMBS class:
dim con as new SQLConnectionMBS
dim f as FolderItem
if TargetMachO then
SQLGlobalsMBS.SetODBCLibrary GetFolderitem("/opt/local/lib/libtdsodbc.so")
end if
try
// connect to database
con.Connect(server.text,user.text,password.text,SQLConnectionMBS.kODBCClient)
MsgBox "We are connected!"
...
Now you just need to enter the right values in the textfields for server, user and password and connect. The server name is "Winline_DB" with the code above.
No comments