cgi sqlite error not able to write data in database

--------------020909050607000207050703
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

hi,
it got some error while adding data into sqlite through Perl script on
Apache ... script can able to read the file but not able to write .. I
have set the permissions of sqlite file to 666 ..

when i ran the script from local user its working fine .. its able to
write the data into db
when i rant that script on Apache its not working ..
i can't figure it out
its is a Apache error or my file permissions?
thank you.
Kanishka

--------------020909050607000207050703--
perl [ Sa, 24 Juli 2010 04:54 ] [ ID #2045054 ]

Re: cgi sqlite error not able to write data in database

On 07/24/2010 08:53 AM, Owen wrote:
>
>> hi,
>> it got some error while adding data into sqlite through Perl script on
>> Apache ... script can able to read the file but not able to write .. I
>> have set the permissions of sqlite file to 666 ..
>>
>> when i ran the script from local user its working fine .. its able to
>> write the data into db
>> when i rant that script on Apache its not working ..
>> i can't figure it out
>> its is a Apache error or my file permissions?
>> thank you.
>> Kanishka
>>
>
>
>
>
> You actually need to provide a little more information.
>
> Do you have this line in your cgi script? If not, put it in.
>
> use CGI::Carp qw (fatalsToBrowser);
>
> The error message from that will give you some clues.
>
>
> Do you have access to the apache(2) logs? If so, read them and see
> what they say
>

This is the Error .. got from Apache ...
DBD::SQLite::db do failed: unable to open database file at

#!/usr/bin/perl
use strict;
use Net::OAuth;
use LWP::UserAgent;
use CGI;
use DBI;
use XML::LibXML;
use YAML;
my $xpc = XML::LibXML::XPathContext->new();
use Data::Random qw(:all);
my $cgi = CGI->new;
print $cgi->header();
my $id = $cgi->param('id');
my $count = $cgi->param('count');
my $screen = $cgi->param('screen');
$Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0A;
use HTTP::Request::Common;
my $i;
my $dbh = DBI->connect("dbi:SQLite:dbname=info.sqlite","","",{AutoComm it
=> 1 })||die(print "$DBI::err $DBI::errstr \t $DBI::state 1 ");
$dbh->do("INSERT INTO list VALUES
('$id','$screen','$count')")||die(print "$DBI::err $DBI::errstr
$DBI::state 2");
$dbh->do("CREATE TABLE $screen ( created TEXT, id NUMERIC, source TEXT,
text TEXT )")||die(print "$DBI::err $DBI::errstr 3");

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
perl [ Sa, 24 Juli 2010 05:42 ] [ ID #2045055 ]

Re: cgi sqlite error not able to write data in database

> On 07/24/2010 08:53 AM, Owen wrote:
>>
>>> hi,
>>> it got some error while adding data into sqlite through Perl script
>>> on
>>> Apache ... script can able to read the file but not able to write
>>> .. I
>>> have set the permissions of sqlite file to 666 ..
>>>
>>> when i ran the script from local user its working fine .. its able
>>> to
>>> write the data into db
>>> when i rant that script on Apache its not working ..
>>> i can't figure it out
>>> its is a Apache error or my file permissions?
>>> thank you.
>>> Kanishka
>>>
>>
>>
>>
>>
>> You actually need to provide a little more information.
>>
>> Do you have this line in your cgi script? If not, put it in.
>>
>> use CGI::Carp qw (fatalsToBrowser);
>>
>> The error message from that will give you some clues.
>>
>>
>> Do you have access to the apache(2) logs? If so, read them and see
>> what they say
>>
>
> This is the Error .. got from Apache ...
> DBD::SQLite::db do failed: unable to open database file at
>
> #!/usr/bin/perl
> use strict;
> use Net::OAuth;
> use LWP::UserAgent;
> use CGI;
> use DBI;
> use XML::LibXML;
> use YAML;
> my $xpc = XML::LibXML::XPathContext->new();
> use Data::Random qw(:all);
> my $cgi = CGI->new;
> print $cgi->header();
> my $id = $cgi->param('id');
> my $count = $cgi->param('count');
> my $screen = $cgi->param('screen');
> $Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0A;
> use HTTP::Request::Common;
> my $i;
> my $dbh =
> DBI->connect("dbi:SQLite:dbname=info.sqlite","","",{AutoComm it
> => 1 })||die(print "$DBI::err $DBI::errstr \t $DBI::state 1 ");
> $dbh->do("INSERT INTO list VALUES
> ('$id','$screen','$count')")||die(print "$DBI::err $DBI::errstr
> $DBI::state 2");
> $dbh->do("CREATE TABLE $screen ( created TEXT, id NUMERIC, source
> TEXT,
> text TEXT )")||die(print "$DBI::err $DBI::errstr 3");
>





Where you have DBI->connect("dbi:SQLite:dbname=info.sqlite" ... i
would have;

made a variable;
my $db = '/full/path/to/info.sqlite'; then said
DBI->connect("dbi:SQLite:$db" ....

I suspect the the server is looking for the database somewhere else

--



Owen


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Owen [ Sa, 24 Juli 2010 07:18 ] [ ID #2045056 ]

Re: cgi sqlite error not able to write data in database

2010/7/24 perl <perlatwork [at] gmail.com>:

>
> This is the Error .. got from Apache ...
> DBD::SQLite::db do failed: unable to open database file at
>

Specify the full path to the sqlite database file.
You may know the absolute path of it, but Apache won't.


--
Jeff Pang
http://home.arcor.de/pangj/

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Jeff Pang [ Sa, 24 Juli 2010 09:06 ] [ ID #2045059 ]

Re: cgi sqlite error not able to write data in database

On 07/24/2010 10:48 AM, Owen wrote:
>
>> On 07/24/2010 08:53 AM, Owen wrote:
>>
>>>
>>>> hi,
>>>> it got some error while adding data into sqlite through Perl script
>>>> on
>>>> Apache ... script can able to read the file but not able to write
>>>> .. I
>>>> have set the permissions of sqlite file to 666 ..
>>>>
>>>> when i ran the script from local user its working fine .. its able
>>>> to
>>>> write the data into db
>>>> when i rant that script on Apache its not working ..
>>>> i can't figure it out
>>>> its is a Apache error or my file permissions?
>>>> thank you.
>>>> Kanishka
>>>>
>>>>
>>>
>>>
>>>
>>> You actually need to provide a little more information.
>>>
>>> Do you have this line in your cgi script? If not, put it in.
>>>
>>> use CGI::Carp qw (fatalsToBrowser);
>>>
>>> The error message from that will give you some clues.
>>>
>>>
>>> Do you have access to the apache(2) logs? If so, read them and see
>>> what they say
>>>
>>>
>> This is the Error .. got from Apache ...
>> DBD::SQLite::db do failed: unable to open database file at
>>
>> #!/usr/bin/perl
>> use strict;
>> use Net::OAuth;
>> use LWP::UserAgent;
>> use CGI;
>> use DBI;
>> use XML::LibXML;
>> use YAML;
>> my $xpc = XML::LibXML::XPathContext->new();
>> use Data::Random qw(:all);
>> my $cgi = CGI->new;
>> print $cgi->header();
>> my $id = $cgi->param('id');
>> my $count = $cgi->param('count');
>> my $screen = $cgi->param('screen');
>> $Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0A;
>> use HTTP::Request::Common;
>> my $i;
>> my $dbh =
>> DBI->connect("dbi:SQLite:dbname=info.sqlite","","",{AutoComm it
>> => 1 })||die(print "$DBI::err $DBI::errstr \t $DBI::state 1 ");
>> $dbh->do("INSERT INTO list VALUES
>> ('$id','$screen','$count')")||die(print "$DBI::err $DBI::errstr
>> $DBI::state 2");
>> $dbh->do("CREATE TABLE $screen ( created TEXT, id NUMERIC, source
>> TEXT,
>> text TEXT )")||die(print "$DBI::err $DBI::errstr 3");
>>
>>
>
>
>
>
> Where you have DBI->connect("dbi:SQLite:dbname=info.sqlite" ... i
> would have;
>
> made a variable;
> my $db = '/full/path/to/info.sqlite'; then said
> DBI->connect("dbi:SQLite:$db" ....
>
> I suspect the the server is looking for the database somewhere else
>
>
Ahh Solved its about the permissions of the Folder not the sever fault
.... i have to give write permission of the folder to WWW ....
Thank's for the help
Kanishka

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
perl [ Sa, 24 Juli 2010 16:44 ] [ ID #2045064 ]
Perl » gmane.comp.lang.perl.beginners » cgi sqlite error not able to write data in database

Vorheriges Thema: perldiver
Nächstes Thema: File::Find usage