Ruby-DBI to query MS SQL 2003 ? (newb)

Discussion in 'Ruby' started by Josiah Ritchie, Jan 11, 2006.

  1. I'm trying to write a script to pull data out of a MS SQL 2003
    database and manipulate it a bit. I've found ActiveRecord to be slim
    on examples outside of the Rails environment.

    I've tried lots of variations on the name of the driver; mssql, msql,
    mysql examples.

    dbh =3D DBI.connect("dbi:msql:wbctest:chad", "testuser", "testpass")

    I've dug into the dbi code some, found that it is case-insensitive
    and, I believe, confirmed that msql is the appropriate one for my
    needs and that it exists under the DBD directory.

    Maybe I'm making this harder than it needs to be? That would be
    common. I will gladly accept corrections in my direction of attack.

    JSR/
     
    Josiah Ritchie, Jan 11, 2006
    #1
    1. Advertising

  2. Josiah Ritchie

    jeem Guest

    I think you want something more like this:

    DBI:ADO:provider=SQLOLEDB;Data Source=YOURSERVER;Initial
    Catalog=YOURDB;User Id=YOU;Password=YOURPASSWORD;

    You may be able to leave the user and pw out of the above string if
    you include them in the 2nd and 3rd args to connect.

    You'll probably need to download the ADO adapter and add it to your
    Ruby install. For some reason, it doesn't come with the windows Ruby
    installer, although DBI does.

    You can get it from
    http://rubyforge.org/frs/download.php/655/ruby-dbi-all-0.0.23.tar.gz.
    Just pull the file "ADO.db" out and stick it in
    <RUBYPATH>\lib\ruby\site_ruby\1.8\DBD\ADO. (You'll have to create the
    ADO directory.)

    Jim


    Josiah Ritchie wrote:
    > I'm trying to write a script to pull data out of a MS SQL 2003
    > database and manipulate it a bit. I've found ActiveRecord to be slim
    > on examples outside of the Rails environment.
    >
    > I've tried lots of variations on the name of the driver; mssql, msql,
    > mysql examples.
    >
    > dbh = DBI.connect("dbi:msql:wbctest:chad", "testuser", "testpass")
    >
    > I've dug into the dbi code some, found that it is case-insensitive
    > and, I believe, confirmed that msql is the appropriate one for my
    > needs and that it exists under the DBD directory.
    >
    > Maybe I'm making this harder than it needs to be? That would be
    > common. I will gladly accept corrections in my direction of attack.
    >
    > JSR/
     
    jeem, Jan 11, 2006
    #2
    1. Advertising

  3. thanks, I'll work on that.

    On 1/11/06, jeem <> wrote:
    > I think you want something more like this:
    >
    > DBI:ADO:provider=3DSQLOLEDB;Data Source=3DYOURSERVER;Initial
    > Catalog=3DYOURDB;User Id=3DYOU;Password=3DYOURPASSWORD;
    >
    > You may be able to leave the user and pw out of the above string if
    > you include them in the 2nd and 3rd args to connect.
    >
    > You'll probably need to download the ADO adapter and add it to your
    > Ruby install. For some reason, it doesn't come with the windows Ruby
    > installer, although DBI does.
    >
    > You can get it from
    > http://rubyforge.org/frs/download.php/655/ruby-dbi-all-0.0.23.tar.gz.
    > Just pull the file "ADO.db" out and stick it in
    > <RUBYPATH>\lib\ruby\site_ruby\1.8\DBD\ADO. (You'll have to create the
    > ADO directory.)
    >
    > Jim
    >
    >
    > Josiah Ritchie wrote:
    > > I'm trying to write a script to pull data out of a MS SQL 2003
    > > database and manipulate it a bit. I've found ActiveRecord to be slim
    > > on examples outside of the Rails environment.
    > >
    > > I've tried lots of variations on the name of the driver; mssql, msql,
    > > mysql examples.
    > >
    > > dbh =3D DBI.connect("dbi:msql:wbctest:chad", "testuser", "testpass")
    > >
    > > I've dug into the dbi code some, found that it is case-insensitive
    > > and, I believe, confirmed that msql is the appropriate one for my
    > > needs and that it exists under the DBD directory.
    > >
    > > Maybe I'm making this harder than it needs to be? That would be
    > > common. I will gladly accept corrections in my direction of attack.
    > >
    > > JSR/

    >
    >
    >
     
    Josiah Ritchie, Jan 11, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dna
    Replies:
    1
    Views:
    1,298
  2. Anonymous
    Replies:
    0
    Views:
    1,532
    Anonymous
    Oct 13, 2005
  3. Charles
    Replies:
    0
    Views:
    116
    Charles
    Apr 14, 2004
  4. int eighty
    Replies:
    2
    Views:
    163
    int eighty
    Oct 29, 2007
  5. Replies:
    68
    Views:
    801
    Waylen Gumbal
    Jun 20, 2008
Loading...

Share This Page