Ruby + sql server

F

Faby

Hi,
I would like to execute a stored procedure using ruby and sql server
2000 with DBI and ODBC.
Can anyone give me an example on how to do it?
Thanks
 
J

James Adam

Hi,
I would like to execute a stored procedure using ruby and sql server
2000 with DBI and ODBC.
Can anyone give me an example on how to do it?
Thanks

Probably the simplest way is use ruby-dbi to open a connection, and
then run the "EXEC <your stored procedure>" SQL as a regular
statement. You should find plenty of resources on the web about using
ruby-dbi.
 
G

grooveska

Hi,
I would like to execute a stored procedure using ruby and sql server
2000 with DBI and ODBC.
Can anyone give me an example on how to do it?
Thanks

Here is what worked for me:

I made an ODBC System DSN named ruby to the DB & Server I wanted to
connect to.

so my ruby script looks like this:

require "dbi"

db = DBI.connect('dbi:ODBC:ruby', 'sa', 'UMsys#07')

storedproc = "EXEC createUser @userName=bob, @password=bob"

stmt = db.prepare(storedproc)
stmt.execute

puts "User Created"

stmt.finish
db.disconnect

Hope that helps...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,239
Messages
2,571,200
Members
47,838
Latest member
elibuskamoSeAve

Latest Threads

Top