 |
Forums |
Admin Start New Thread
By: Parv G
RE: Error: "in load_driver: is not a class/modul [ reply ] 2006-07-03 03:55
|
After doing some more research on this issue, i found out that i was missing ADO.rb in ....c:/ruby/lib/ruby/site_ruby/1.8/DBD/ADO. i installed the file ADO.rb in its' place and everything seems to be fine, well at least for now.
Thank you for your time, it is appreciated.
Parv
|
By: Parv G
RE: Error: "in load_driver: is not a class/modul [ reply ] 2006-07-03 03:24
|
Carl,
Thanks for your help.
After running the code you posted i'm still getting exactly the same error.
I'm using sql server 2005 and i'm trying to connect to the database using windows authentication.
I think i need to start exploring other options available in the ruby world.
Thanks,
|
By: Carl Graff
RE: Error: "in load_driver: is not a class/modul [ reply ] 2006-07-02 20:44
|
OK - I think this will work for you - note the different driver SQLOLEDB:
----------------------
require 'dbi'
def databases
db = Array.new
dbh=DBI.connect("DBI:ADO:Provider=SQLOLEDB;Data Source=SQLDEV;Integrated Security=SSPI")
sth = dbh.execute('SELECT name FROM master..sysdatabases ORDER BY 1')
while row = sth.fetch do
db << row[0]
end
sth.finish
puts db
end
databases()
|
By: Carl Graff
RE: Error: "in load_driver: is not a class/modul [ reply ] 2006-07-02 20:07
|
Hi Parv,
I have resolved my error with stored procedures and learned acouple of things along the way:
1. The ODBC driver is much more reliable for SQL200 - not sure about 2005 - but it does require you set up ODBC DSN. This is usually farly easy to do unless you have to do it on a bunch of machines.
2. If your stored procedure calls other stored procedures you must make sure to "fetch" any output that the nested stored procedures may be producing otherwise the DBI call to the parent stored procedure will fail silently.
I think I will be creating a class or method that will parse and process stament and stored proc calls and post it to DBI area on the internet. It really is best to use parameritized calls so it will pick apart a string such as "exec sp_1 'Y', 'N'" and correctly run the correct DBI statements using parameters.
More to the point on you code:
1. ...Integrated Security=SSPI")
I am not sure what this paaremter does yet - are you using 2005? Is it absolutely necessary?
2. I will follow this up with another reply after I try this code in my SQL2000 environment.
Best,
Carl
|
By: Parv G
Error: "in load_driver: is not a class/modul [ reply ] 2006-07-02 03:53
|
Hi,
I have ruby version 1.8.4.
I'm trying to run a simple script to connect to sql server db, but i keep on getting the error below:
C:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:499:in `load_driver': is not a class/module (TypeError)
from C:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:401:in `_get_full_driver'
from C:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:381:in `connect'
from U:/Projects/PTIS2/DB/connDB.rb:5:in `databases'
from U:/Projects/PTIS2/DB/connDB.rb:14
Here's the script i'm running:
require 'dbi'
def databases
db=Array.new
$dbh=DBI.connect("DBI:ADO:Provider=SQLNCLI;Data Source=SQLDEV;Integrated Security=SSPI")
$dbh.select_all('SELECT name FROM master.sys.databases ORDER BY 1') do | row |
db.<< Database.new($dbh,row[0])
end
db
end
databases()
Any help would be much appreciated. I am new to ruby and trying to find a way to connect to a sql server 2005 database. If you have any alternatives to accomplish this, please do let me konw.
Thanks in advance for your help.
Parv
|
|
 |