Re: Database access & CGI
--- Rob Dixon <[EMAIL PROTECTED]> wrote: > Hi Frank. > > We can only speculate as to what your problem may be > until we know a little more about your script. Can you post > an extract of what you think is the relevant area? > > Cheers, > > Rob Hi Rob...here you have the code: === my $dbconnection='DBI:mysql:ROI';#The connection string to the db my $dbuser='kiwadmin'; #The user of the DB my $dbpwd='kiwadmin';#The db pwd my $dbh=DBI->connect($dbconnection,$dbuser,$dbpwd) or die "cannot connect to the DB"; Now..in the Apache log I can read this: DBI->connect(ROI) failed: Access denied for user: '[EMAIL PROTECTED]' === How can I avoid the Webserver add domain to the user? tnx Frank __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Database access & CGI
"Francesco Del Vecchio" <[EMAIL PROTECTED]> wrote: > I wrote a small program accessing a Mysql database. > > All works fine when I run it from shell, but when I try to use it as CGI using > apache 2.0 I'm > having this kind of trouble: > > when he access to the database, looks like he append to the user name the > domain...so if all works > properly from shell with the user 'ADMIN' the access is denied to the user '[EMAIL > PROTECTED]' that > the CGI is trying to use to connect to the DB. Hi Frank. It looks like your script may be using the username intended for access to the the host, not the one used to access the database. The string '[EMAIL PROTECTED]' is a host name with a username included, and can be used in a URL: http://[EMAIL PROTECTED]/cgi-bin/script.pl so I wonder if somehow you're using the string in the wrong context. Are you fetching the username from the evironment variables provided by Apache? We can only speculate as to what your problem may be until we know a little more about your script. Can you post an extract of what you think is the relevant area? Cheers, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Database Access Problem (again)
OOPS!! Thank you! That "a" was the problem. :) -garrett >From: Felix Geerinckx <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Re: Database Access Problem (again) >Date: 2 May 2002 20:25:22 - > >on Thu, 02 May 2002 20:11:29 GMT, Garrett Esperum wrote: > > > This is the error message I recieve when I run my script: > > > > DBD::Oracle::db prepare failed: ORA-00904: invalid column name (DBD > > ERROR: OCIStmtExecute/Describe) at 3mfiles.pl line 63. > > DBD::Oracle::db prepare failed: ORA-00904: invalid column name (DBD > > ERROR: OCIStmtExecute/Describe) at 3mfiles.pl line 63. > > Issuing rollback() for database handle being DESTROY'd without > > explicit disconnect(). > > > >[ SQL statement reformatted] > > > my $sql = qq{ > > SELECT > > c.oid AS folder_oid > > FROM dp_doc_folder_content c, bv_ep_proj_attach > > WHERE > > c.DOC_DELETED=0 > > AND c.DOC_OID=a.ASSOC_CONTENT > > AND a.file_path = '$rootDir/$projectId/$docName' > > }; > >You don't have an 'a' table (or alias) in your 'from' clause, but you have >two 'a.fields' in your 'where' clause -> two 'invalid column errors'. > > > I think I am screwing up the whole while loop. > >The while loop looks OK to me. > > >-- >felix > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Database Access Problem (again)
on Thu, 02 May 2002 20:11:29 GMT, Garrett Esperum wrote: > This is the error message I recieve when I run my script: > > DBD::Oracle::db prepare failed: ORA-00904: invalid column name (DBD > ERROR: OCIStmtExecute/Describe) at 3mfiles.pl line 63. > DBD::Oracle::db prepare failed: ORA-00904: invalid column name (DBD > ERROR: OCIStmtExecute/Describe) at 3mfiles.pl line 63. > Issuing rollback() for database handle being DESTROY'd without > explicit disconnect(). > [ SQL statement reformatted] > my $sql = qq{ > SELECT > c.oid AS folder_oid > FROM dp_doc_folder_content c, bv_ep_proj_attach > WHERE > c.DOC_DELETED=0 > AND c.DOC_OID=a.ASSOC_CONTENT > AND a.file_path = '$rootDir/$projectId/$docName' > }; You don't have an 'a' table (or alias) in your 'from' clause, but you have two 'a.fields' in your 'where' clause -> two 'invalid column errors'. > I think I am screwing up the whole while loop. The while loop looks OK to me. -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Database Access Problem (again)
This is the error message I recieve when I run my script: DBD::Oracle::db prepare failed: ORA-00904: invalid column name (DBD ERROR: OCIStmtExecute/Describe) at 3mfiles.pl line 63. DBD::Oracle::db prepare failed: ORA-00904: invalid column name (DBD ERROR: OCIStmtExecute/Describe) at 3mfiles.pl line 63. Issuing rollback() for database handle being DESTROY'd without explicit disconnect(). What is wrong with my code? --- ## SQL query for folder OID $rootDir = "/Adventech/projects"; my $dbh = DBI->connect( 'dbi:Oracle:thedb', 'user', 'password', { RaiseError => 1, AutoCommit => 0 } ) || die "Database connection not made: $DBI::errstr"; my $sql = qq{ SELECT c.oid AS folder_oid FROM dp_doc_folder_content c, bv_ep_proj_attach WHERE c.DOC_DEL ETED=0 AND c.DOC_OID=a.ASSOC_CONTENT AND a.file_path = '$rootDir/$projectId/$docName' }; my $sth = $dbh->prepare ( $sql ); $sth->execute or die "Can't execute sth: $DBI::errstr."; while( my@row = $sth->fetchrow_array ) { my$oid=$row[0]; print "$oid\n"; } $sth->finish(); $dbh->disconnect(); I think I am screwing up the whole while loop. -garrett >From: "garrett esperum" <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Database Access Problem (again) >Date: Thu, 02 May 2002 11:45:33 -0700 > >Hello all again, > >Solaris, Perl 5, Oracle 8.1.6 > >OK, so here I am... Now I am having issues accessing my database from my >Perl SQL query. I want to query my DB and put it's response into a variable >to be used later. I really think that I am structuring my perl query wrong. >How do I get my SELECT statement to work and put the query answer into a >variable? I don't have much experience with this. Again, I am running this >script against strings like: > >/export/home/user/www/doc-root/directory/projects/19463/1_0001.doc > >Below is my whole script thus far: > >#USAGE: migratefiles Path ># ># ex: migratefiles > >use DBI; >process_files($ARGV[0]); > ># > >sub process_files { >$dir=shift; >$_ = $dir; >if (!/\/$/) { > $dir = $dir."/"; >} >@flist; >print "Specified Directory: $dir\n"; > >if (opendir(DIRH, "$dir")) { >@flist=readdir(DIRH); >closedir DIRH; >foreach $flist (@flist) { ## loop through directory list >$_ = $flist; >next if ($_ eq "." || $_ eq ".."); >$projectDocDir = $dir.$_; >print "PROCESS: $projectDocDir\n"; > > >##loop through files in project document directory > >if (opendir(DIRH, "$projectDocDir")) { >@dirlist=readdir(DIRH); >closedir DIRH; >foreach $dirlist (@dirlist) { ## loop through Project Doc >directory list >$_ = $dirlist; >next if ($_ eq "." || $_ eq ".."); >if (! -l "$projectDocDir/$_"){ >print "$projectDocDir/$_\n"; >} > > > >##put yur filename with .dir in $_ >##$docName =~ s/(.*)\.dir$/$1/; ## strip off >".dir" >$docName = substr($_, 0, length($_)-4); >$docFolder = "$projectDocDir/$_"; >print "$docName , $docFolder\n"; >##get the project id >$projectId = substr($projectDocDir, length($dir), >index($projectDocDir, "/", length($dir)-1)); >print "$projectId\n"; > >## SQL query for folder OID >$rootDir = "directory/projects"; > >my $dbh = DBI->connect( 'dbi:Oracle:thedb', >'user', >'passwd', >{ >RaiseError => 1, >AutoCommit => 0 >} >) || die "Database connection not made: $DBI::errstr"; > >my $sql = qq{ SELECT c.oid AS folder_oid > FROM dp_doc_folder_content c, bv_ep_proj_attach a > WHERE c.DOC_DELETED=0 > AND c.DOC_OID=a.ASSOC_CONTENT > AND a.file_path = '$rootDir/$projectId/$docName' }; > >my $sth = $dbh->prepare ( $sql ); >$sth->execute(); > >while( my@row = $sth->fetchrow_array ) >{ >my$oid=$row[0]; >print
Re: Database access
You can if the database is accessible from the webserver. Read about apache (www.apache.org) and perl (www.perl.org), especially the modules CGI.pm and DBI.pm. /Jon Allison Davis wrote: > > Can anyone tell me if you can have all the members of our origanization > access our database on the web to change their personal information only. > We want each member to have their own user id and password. > > Thanks for your help > Allison > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]