database access problem through cgi script

R

Raju Alluri

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
 
T

Tony Lawetta

Raju said:
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.
 

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

Similar Threads

CGI help 18
Cgi test failure. 2
Sending form data to a text file 4
CGI::Session just don't work 3
cgi vs. fcgi question 9
Private methods fail when called from CGI 0
cgi question 0
cgi scripts and external css 5

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top