[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: DBI with SQL Server

Warren Brown

10/25/2004 10:30:00 PM

Eli,

> Can someone give me a little help with DBI when
> connecting to SQL Server?
> ...
> db = DBI.connect("DBI:ODBC:driver={SQL
> Server};Server=kint;Database=MyJournal;UID=test;PWD=test")

If you are using ODBC, you should be able to use:

db = DBI.connect("dbi:ODBC:myodbcdatasourcename")

You can set up the rest of the information in the ODBC datasource
itself.

I hope this helps.

- Warren Brown





3 Answers

Eli Tucker

10/25/2004 11:06:00 PM

0

Hi Warren. Thanks for your help. That worked.

But is there a way to specify the complete connection string and avoid
setting up an ODBC data source? In other words, if I wanted to define
all of the parameters in the connection string like the ODBC connection
string "Driver={SQL
Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;", is there a way
to do that?

Thanks again for your help!
- Eli

Robo

10/25/2004 11:51:00 PM

0

Eli Tucker wrote:
> Hi Warren. Thanks for your help. That worked.
>
> But is there a way to specify the complete connection string and avoid
> setting up an ODBC data source? In other words, if I wanted to define
> all of the parameters in the connection string like the ODBC connection
> string "Driver={SQL
> Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;", is there a way
> to do that?
>
> Thanks again for your help!
> - Eli
>
I think the usual convention is something like:

db = DBI.connect("dbi:ODBC:dsn:localhost", "user", "pw")

Robo

Nikos Polizotis

10/26/2004 7:25:00 AM

0

As far as I know tha latest version of the odbc driver works with
connection strings as
well
I am using

DBI.connect('dbi:ODBC:'+'%q{DRIVER=SQL
Server;SERVER=sqlserver;DATABASE=db;Uid=userid;Pwd=password})

for a standard connection

On Tue, 26 Oct 2004 08:54:05 +0900, Robo <robo@mars.com> wrote:
> Eli Tucker wrote:
>
>
> > Hi Warren. Thanks for your help. That worked.
> >
> > But is there a way to specify the complete connection string and avoid
> > setting up an ODBC data source? In other words, if I wanted to define
> > all of the parameters in the connection string like the ODBC connection
> > string "Driver={SQL
> > Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;", is there a way
> > to do that?
> >
> > Thanks again for your help!
> > - Eli
> >
> I think the usual convention is something like:
>
> db = DBI.connect("dbi:ODBC:dsn:localhost", "user", "pw")
>
> Robo
>
>