[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

dbi connection

aidy

6/24/2008 5:49:00 PM

Hi,

Could anyone please tell me where I place the database name in this
connection string

require 'dbi'
server_name='test7'
dbh=DBI.connect("DBI:ADO:Provider=SQLOLEDB;Data
Source=#{server_name};Integrated Security=SSPI") ?


I have tried

server_name='test7:Order'

But I get an 'invalid connection' exception.

Thanks

Aidy
3 Answers

aidy

6/24/2008 6:37:00 PM

0

Hi,

I seem to be getting a connection

<code>
require 'dbi'

server_name='test7'
db = 'Order'
dbh=DBI.connect("DBI:ADO:Provider=SQLOLEDB;Data
Source=#{server_name};Intitial Catalog=#{db};Integrated
Security=SSPI")

if dbh
puts "connected"
else
puts "not connected"
end

dbh.execute('SELECT * FROM sys.Tables')

</code>

However, when I try to list all tables, I am receiving "Invalid
object name 'sys.Tables'.

Aidy

Phlip

6/24/2008 6:51:00 PM

0

aidy wrote:

> Could anyone please tell me where I place the database name in this
> connection string
>
> require 'dbi'
> server_name='test7'
> dbh=DBI.connect("DBI:ADO:Provider=SQLOLEDB;Data
> Source=#{server_name};Integrated Security=SSPI") ?

At a guess, if you are using Windows - and if Windows still has a Control Panel
- go to it and configure a database provider. The real name goes in there, IIRC.
Then link to the provider under server_name.

aidy

6/24/2008 7:09:00 PM

0

On Jun 24, 11:50 am, Phlip <phlip2...@gmail.com> wrote:

> At a guess, if you are using Windows - and if Windows still has a Control Panel
> - go to it and configure a database provider. The real name goes in there, IIRC.
> Then link to the provider under server_name.

Thanks Phlip .... I need shooting

Aidy