Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > database access problem through cgi script

Reply
Thread Tools

database access problem through cgi script

 
 
Raju Alluri
Guest
Posts: n/a
 
      12-28-2008
Hi,
I am trying to print a set of data from database with a CGI script. This
script works fine a simple ruby script. But doesnt work in cgi script.
Any help is appreciated.


connection = WIN32OLE.new('ADODB.Connection')
connection.Open('Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\INFOPROJECT\db1.mdb')
recordset = WIN32OLE.new('ADODB.Recordset')
sql = "select * from GuestBook"
recordset.Open(sql, connection)
data = recordset.GetRows #.transpose
puts data
recordset.Close
connection.close

How can i call the above statements in below cgi script to make it work.

#!/usr/bin/ruby
require 'win32ole'
require 'cgi'

cgi = CGI.new("html3")
cgi.out() do
cgi.html() do
cgi.head{ cgi.title{"DATABASE"} } +
cgi.body() do
cgi.form() do
cgi.textarea("get_text") +
cgi.br +

end
end
end
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Tony Lawetta
Guest
Posts: n/a
 
      12-28-2008
Raju Alluri wrote:
> Hi,
> I am trying to print a set of data from database with a CGI script. This
> script works fine a simple ruby script. But doesnt work in cgi script.
> Any help is appreciated.


When calling it on the console it is you (i.e. the user ID you are
logged in with).
When calling the CGI it is the webserver (i.e. the user ID under which
it is running) that is executing your code.

Are you sure that the webserver has the permission to connect to the DB?

T.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
what's wrong calling a Perl/CGI script in Perl/CGI script under Tomcat server? kath Perl Misc 4 04-09-2007 09:21 PM
Java access to Microsoft Access database through Samba JC Java 3 06-18-2006 11:41 PM
Python-cgi or Perl-cgi script doubt praba kar Python 1 07-30-2005 08:25 AM



Advertisments