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: Jon Connolly <jon AT dimax.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] dsn-less string for ruby dbi
  • Date: Thu, 5 Mar 2009 11:52:46 -0800

Chad...what can I say but your pure genius. That worked like a charm. I
created params for the server, port and ttd version:
DBI.connect("DBI:ODBC:DRIVER=FreeTDS;SERVER=172.xxx.xxx.xxx;PORT=1433;DATABASE=somedbname;TDS_VERSION=7.0",
"uid", "pwd")
It looks like I will only need to use the odbcinst.ini to point to the
drivers. The odbc.ini and freetds.conf are now appear to be unnessesary.
Once again a big thank you.

Jon Connolly

On Thu, Mar 5, 2009 at 8:12 AM, Chad Johnson
<chadjamesjohnson AT gmail.com>wrote:

> 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
> _______________________________________________
> 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