Posts filed under 'Networking'

Fun in the world of FreeBSD interconnectivity

The problem is thus: you’re using anything but Windows, and you need to access data from a Windows server; this means you’re probably dealing with MS SQL Server of one form or another. (If you’re lucky it’s something like MySQL, and then it’s painfully simple, but these things are never simple.)

The ultimate goal, in my case, was to bring the data from MS SQL Server over to my web application, running in PHP. Although I’ve struggled with the specifics in the past, the solution really isn’t so bad. What you need:

  1. ODBC connector setup on the MS SQL Server side, and remote access enabled; I’m by no means an expert here, so I’ll avoid the detail here where Google could server you better.
  2. FreeTDS installed. “…a set of libraries for Unix and Linux that allows your programs to natively talk to Microsoft SQL Server and Sybase databases.”

There are two configuration files you need to worry about for FreeTDS, and by default these are both in /usr/local/etc/: odbc.ini and freetds.conf.

freetds.conf: For this, you have to create your own section for the particular server, but any options that you don’t include will come from the [global] section’s defaults, and these seem to work just fine. In my own example, the only things I needed to set up were like so:


[Xirtam]
host = 172.30.80.42
port = 1433
nt domain = ZEE

The options there should be fairly self-explanatory.

odbc.ini: Here, you first define your server in the top section, [ODBC Data Sources], with an optional description, i.e. “Xirtam=MS SQL Server 2005 connection”. Then, in a section below, you define the gritty detail:


[Xirtam]
Driver=/usr/local/lib/libtdsodbc.so.0
Description=FreeTDS Connection
Trace=No
Servername=Xirtam
UID=administrator
Port=1433

The item identified in brackets above, “Xirtam” is the DSN. This is used in the final connection code, which you could test with isql or some other tool, or just jump straight to the PHP connection code:


$connect = odbc_connect($DSN, $user, $pass);
$result = odbc_exec($connect, "USE databaseOfDoom");

The rest is left as an exercise to the reader.

1 comment June 10th, 2007

CoRD

Although I try to avoid it, my work generally entails a lot of mucking around with Windows machines. On my venerable old PowerBook G4, I would use Microsoft’s own Remote Desktop Connection Client. Version 1.03 of course, which hasn’t been updated in nearly three years. It doesn’t come quite as feature-rich as the native Windows version, of course, but it was serviceable.

After my switch to an Intel-based Mac, however, MS’s RDP client just fails for me. It seemed my only options were:

  1. Wait for Microsoft to update their RDP client (unlikely)
  2. Use X11 and rdesktop (unwieldy)
  3. Use Parallels and run a virtual XP

I chose option three because having Parallels around means access to other useful things, such as viewing web projects in finicky IE, and the ability to reinstall UT2k4 on Windows from a friend’s disc when my own Mac DVD got too scratched to work. However, I kept finding myself booting up Windows for the express purpose of RDP’ing into another machine. Hardly an elegant solution.

Enter CoRD, “Cocoa Remote Desktop”, which is a native OS X version of the above-mentioned rdesktop. It’s only in a 0.4 version at the moment, but is already more utilitarian than the old MS version, even if the screen render ain’t quite as pretty. I’ve been hoping someone with the knowhow would put this together, it’s going to be a huge timesaver.

Add comment May 31st, 2007

Life on the fringe of network knowledge

An interesting tidbit that I learned after, having successfully moved up to Portland, getting my internet working again, and (finally) getting wireless re-deployed:

Apparently, the Comcast cable modem will bind to the first device that sends traffic through it. Isn’t that sweet of it? So in order to get the wireless router working, it was simply: hook up the wireless router, reset the modem, reset the router, then connect! Voila.

Add comment April 25th, 2007


Calendar

July 2008
M T W T F S S
« Jun    
 123456
78910111213
14151617181920
21222324252627
28293031  

Posts by Month

Posts by Category