Jon Kinney - Home > Blog > Change locale on os x snow leopard for FreeTDS functionality

Change locale on os x snow leopard for FreeTDS functionality

 -Monday, November 23, 2009 By: Jon Kinney

Recently I've been trying to get my new unibody macbook pro connecting to SQL Server 2005 with FreeTDS. I was following the great guide from the Ken Collins the author of the rails-sqlserver activerecord adapter that I use but no matter what configuration settings I edited I couldn't get my machine to connect to the SQL Server.

When checking the event viewer on the Windows Server 2k8 box I received the following error:

   1  "The login packet used to open the connection is structurally invalid; 
   2  the connection has been closed. Please contact the vendor of the client 
   3  library."

I was pretty sure it had to do with my locale because if that was incorrect it would make sense that the packets might be structurally invalid. My locale was set to "en_US.us-ascii" the default setting apparently after a clean OS X Snow Leopard install. The problem was that I couldn't figure out how to change it. Then I ran across this archived post and I was able to temporarily change my locale by typing:

   1  export LC_ALL=en_US.UTF-8

I was able to verify my locale settings by typing "locale" in a terminal window which yielded the following:

   1  LANG=
   2  LC_COLLATE="en_US.UTF-8"
   3  LC_CTYPE="en_US.UTF-8"
   4  LC_MESSAGES="en_US.UTF-8"
   5  LC_MONETARY="en_US.UTF-8"
   6  LC_NUMERIC="en_US.UTF-8"
   7  LC_TIME="en_US.UTF-8"
   8  LC_ALL="en_US.UTF-8"

The problem is if I opened a new terminal window my locale was back to the default ascii junk. To make this change permanent I simply had to edit my ~/.profile and add the export statement that we set earlier to the bottom of the file.

   1  export LC_ALL=en_US.UTF-8

Now when I open a new window and type 'locale' it says "en_US.UTF-8" for everything. At this point I was able to continue following Ken's guide for testing the TSQL commands and getting ruby-dbi and everything else wired up.

0 comments. Tags:

Article Navigation

« BDD: My quest to become a professional tester  ||  

News & Events()

Tech Review: Web Design For Developers - June 2009

A friend of mine in the web development community is releasing a book called "Web Design for Developers: A Programmer's Guide to Design Tools and Techniques". I was asked to do a tech review of the book and will be sharing my thoughts as well as some cool info presented in the book in a short series of upcoming blog posts. If you want to grab a beta copy of the book head over to my favorite publisher The Pragmatic Programmers.

First Class Audio Production - March 1st 2009

My most recent studio project was mixing and producing the latest a cappella album to come out of Eau Claire, WI. Until Proven Guilty is the Innocent Men's 4th studio album and marks a huge leap forward in recording and production quality for the group. Check back for demos of the mastered songs very soon! http://theinnocentmen.com.

Rate This Post: 0 (average)

Tag Cloud { }

  1. 3 pages are tagged with General
  2. 2 pages are tagged with cron
  3. 4 pages are tagged with development
  4. 5 pages are tagged with rails
  5. 4 pages are tagged with ruby

Twitter Feed (follow me)