Skip to Content.
Sympa Menu

freetds - Re: [freetds] dsn-less string for ruby dbi

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Chad Johnson <chadjamesjohnson AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] dsn-less string for ruby dbi
  • Date: Thu, 5 Mar 2009 10:12:59 -0600

I have found this to be tricky to pull off as well.  Here are a few pointers.

1.) First I authored a monkey patch to fix how DBD::ODBC passes
credentials to the underlying DB driver.

http://gist.github.com/74394

2.) Make sure that you have a FreeTDS entry in your odbcinst.ini file
(/etc/odbcinst.ini)

http://gist.github.com/74401

3.) I'm a big fan of Unicode support in my apps, so to do that, you
need to override the "client charset" property (and from my testing
this is the ONLY way to override this setting) for the server you are
connecting to in the freetds.conf file (/etc/freetds.conf)

http://gist.github.com/74409

`dbservername` is important to remember as we will be referring to
this server name in our DSNless connection below.

4.) Connect DSNless!

http://gist.github.com/74413

Hope that helps!
-Chad Johnson

On Wed, Mar 4, 2009 at 1:11 PM, Jon Connolly <jon AT dimax.com> wrote:
>
> Hi, I am creating a user defined db connector for rails, which will allow
> the user to connect to their db. Because of this, using the odbc.ini,
> odbcinst.ini, and freetds.conf is not practical. To reiterate, this is a
> connection in addition to the Active Record connection. The connection uses
> Ruby's DBI library in the form of
> DBI.connect('ODBC:MY_DSN', 'user', 'pass')
> I would like to add the params string rather than use the freetds.conf and
> the two ini files,  but I am usure how to do this, or if it can even be done
> using the ruby DBI.
> I have tried
> DBI.connect('ODBC:driver=path/to/driver;server=server;uid=user;pwd=secret
> but this does not work. I also looked at the entry on the Freetds user
> guide:
> http://www.freetds.org/userguide/dsnless.htm#E.G.SAMPLEDSNLESS
> Since I am not a C programmer I don't really know how I could use this.
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page