Beginners bad luck

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Beginners bad luck

Aharon (Rony) Shapira

I created a simple table named "books" in "library.db".
After entering "select * from books" I saw the data that I put into it.

When trying to access it through php:
$file = "library.db";
// open database file

$handle = sqlite_open($db) or die("Could not open database");

I got the following:

"Could not open database"



When I tried the following:

$file = "library.db";

// create database object

$db = new SQLiteDatabase($file) or die("Could not open database");

I got the following:

Fatal error: Uncaught exception 'SQLiteException' with message 'SQLiteDatabase::__construct() [<a href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]: file is encrypted or is not a database' in /home/zbfckla/public_html/Ocx.php:17 Stack trace: #0 /home/zbfckla/public_html/Ocx.php(17): SQLiteDatabase->__construct('library.db') #1 {main} thrown in /home/zbfckla/public_html/Ocx.php on line 17



Once again I apologies for these silly questions.

Aharon
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

Puneet Kishor-2
I don't know how PHP's db connector works but...

On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>
>  I created a simple table named "books" in "library.db".
>  After entering "select * from books" I saw the data that I put into it.
>
>  When trying to access it through php:
>  $file = "library.db";
>  // open database file
>
>  $handle = sqlite_open($db) or die("Could not open database");

Is that a typo? You are setting $file, but trying to open $db.


>
>  I got the following:
>
>  "Could not open database"
>
>
>
>  When I tried the following:
>
>  $file = "library.db";
>
>  // create database object
>
>  $db = new SQLiteDatabase($file) or die("Could not open database");
>
>  I got the following:
>
>  Fatal error: Uncaught exception 'SQLiteException' with message 'SQLiteDatabase::__construct() [<a href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]: file is encrypted or is not a database' in /home/zbfckla/public_html/Ocx.php:17 Stack trace: #0 /home/zbfckla/public_html/Ocx.php(17): SQLiteDatabase->__construct('library.db') #1 {main} thrown in /home/zbfckla/public_html/Ocx.php on line 17
>
>
>
>  Once again I apologies for these silly questions.
>
>  Aharon
>  _______________________________________________
>  sqlite-users mailing list
>  [hidden email]
>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


--
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

Aharon (Rony) Shapira
Sorry. When I set $db and use $db the message I get is:

Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is not a
database in /home/zbfckla/public_html/Ocx.php on line 49
Could not open database



----- Original Message -----
From: "P Kishor" <[hidden email]>
To: "General Discussion of SQLite Database" <[hidden email]>
Sent: Sunday, March 09, 2008 5:02 PM
Subject: Re: [sqlite] Beginners bad luck


>I don't know how PHP's db connector works but...
>
> On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>>
>>  I created a simple table named "books" in "library.db".
>>  After entering "select * from books" I saw the data that I put into it.
>>
>>  When trying to access it through php:
>>  $file = "library.db";
>>  // open database file
>>
>>  $handle = sqlite_open($db) or die("Could not open database");
>
> Is that a typo? You are setting $file, but trying to open $db.
>
>
>>
>>  I got the following:
>>
>>  "Could not open database"
>>
>>
>>
>>  When I tried the following:
>>
>>  $file = "library.db";
>>
>>  // create database object
>>
>>  $db = new SQLiteDatabase($file) or die("Could not open database");
>>
>>  I got the following:
>>
>>  Fatal error: Uncaught exception 'SQLiteException' with message
>> 'SQLiteDatabase::__construct() [<a
>> href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]:
>> file is encrypted or is not a database' in
>> /home/zbfckla/public_html/Ocx.php:17 Stack trace: #0
>> /home/zbfckla/public_html/Ocx.php(17):
>> SQLiteDatabase->__construct('library.db') #1 {main} thrown in
>> /home/zbfckla/public_html/Ocx.php on line 17
>>
>>
>>
>>  Once again I apologies for these silly questions.
>>
>>  Aharon
>>  _______________________________________________
>>  sqlite-users mailing list
>>  [hidden email]
>>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
> --
> Puneet Kishor http://punkish.eidesis.org/
> Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
> Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

Puneet Kishor-2
On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
> Sorry. When I set $db and use $db the message I get is:
>
>  Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is not a
>  database in /home/zbfckla/public_html/Ocx.php on line 49
>  Could not open database
>

again, no idea about PHP, but check once again if you can open the db
ok from the command line. Also, confirm that the db is not on a
network drive.

If the db opens ok from the command line, it is some kind of PHP
problem. Ask for help on the PHP forum unless a PHP user on this list
can help. If the db does not open ok from the command line, the db is
really fubar because of "unknown" reasons. Recreate the db and try
again.

Good luck.


>
>
>
>  ----- Original Message -----
>  From: "P Kishor" <[hidden email]>
>  To: "General Discussion of SQLite Database" <[hidden email]>
>  Sent: Sunday, March 09, 2008 5:02 PM
>  Subject: Re: [sqlite] Beginners bad luck
>
>
>  >I don't know how PHP's db connector works but...
>  >
>  > On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>  >>
>  >>  I created a simple table named "books" in "library.db".
>  >>  After entering "select * from books" I saw the data that I put into it.
>  >>
>  >>  When trying to access it through php:
>  >>  $file = "library.db";
>  >>  // open database file
>  >>
>  >>  $handle = sqlite_open($db) or die("Could not open database");
>  >
>  > Is that a typo? You are setting $file, but trying to open $db.
>  >
>  >
>  >>
>  >>  I got the following:
>  >>
>  >>  "Could not open database"
>  >>
>  >>
>  >>
>  >>  When I tried the following:
>  >>
>  >>  $file = "library.db";
>  >>
>  >>  // create database object
>  >>
>  >>  $db = new SQLiteDatabase($file) or die("Could not open database");
>  >>
>  >>  I got the following:
>  >>
>  >>  Fatal error: Uncaught exception 'SQLiteException' with message
>  >> 'SQLiteDatabase::__construct() [<a
>  >> href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]:
>  >> file is encrypted or is not a database' in
>  >> /home/zbfckla/public_html/Ocx.php:17 Stack trace: #0
>  >> /home/zbfckla/public_html/Ocx.php(17):
>  >> SQLiteDatabase->__construct('library.db') #1 {main} thrown in
>  >> /home/zbfckla/public_html/Ocx.php on line 17
>  >>
>  >>
>  >>
>  >>  Once again I apologies for these silly questions.
>  >>
>  >>  Aharon
>  >>  _______________________________________________
>  >>  sqlite-users mailing list
>  >>  [hidden email]
>  >>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>  >>
>  >
>  >
>  > --
>  > Puneet Kishor http://punkish.eidesis.org/
>  > Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
>  > Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
>  > _______________________________________________
>  > sqlite-users mailing list
>  > [hidden email]
>  > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>


--
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

Zbigniew Baniewski
In reply to this post by Aharon (Rony) Shapira
On Sun, Mar 09, 2008 at 03:51:23PM +0300, Aharon (Rony) Shapira wrote:

> I created a simple table named "books" in "library.db".
> After entering "select * from books" I saw the data that I put into it.
>
> When trying to access it through php:
> $file = "library.db";
> // open database file
>
> $handle = sqlite_open($db) or die("Could not open database");

Perhaps try to point full path to database file, then use something like:

$handle = sqlite_open("$path$file", 0666, $error)
--
                                pozdrawiam / regards

                                                Zbigniew Baniewski
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

John Stanton-3
In reply to this post by Puneet Kishor-2
PHP has Sqlite V2 embedded.  Use PDO to get Sqlite3.

P Kishor wrote:

> On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>
>>Sorry. When I set $db and use $db the message I get is:
>>
>> Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is not a
>> database in /home/zbfckla/public_html/Ocx.php on line 49
>> Could not open database
>>
>
>
> again, no idea about PHP, but check once again if you can open the db
> ok from the command line. Also, confirm that the db is not on a
> network drive.
>
> If the db opens ok from the command line, it is some kind of PHP
> problem. Ask for help on the PHP forum unless a PHP user on this list
> can help. If the db does not open ok from the command line, the db is
> really fubar because of "unknown" reasons. Recreate the db and try
> again.
>
> Good luck.
>
>
>
>>
>>
>> ----- Original Message -----
>> From: "P Kishor" <[hidden email]>
>> To: "General Discussion of SQLite Database" <[hidden email]>
>> Sent: Sunday, March 09, 2008 5:02 PM
>> Subject: Re: [sqlite] Beginners bad luck
>>
>>
>> >I don't know how PHP's db connector works but...
>> >
>> > On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>> >>
>> >>  I created a simple table named "books" in "library.db".
>> >>  After entering "select * from books" I saw the data that I put into it.
>> >>
>> >>  When trying to access it through php:
>> >>  $file = "library.db";
>> >>  // open database file
>> >>
>> >>  $handle = sqlite_open($db) or die("Could not open database");
>> >
>> > Is that a typo? You are setting $file, but trying to open $db.
>> >
>> >
>> >>
>> >>  I got the following:
>> >>
>> >>  "Could not open database"
>> >>
>> >>
>> >>
>> >>  When I tried the following:
>> >>
>> >>  $file = "library.db";
>> >>
>> >>  // create database object
>> >>
>> >>  $db = new SQLiteDatabase($file) or die("Could not open database");
>> >>
>> >>  I got the following:
>> >>
>> >>  Fatal error: Uncaught exception 'SQLiteException' with message
>> >> 'SQLiteDatabase::__construct() [<a
>> >> href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]:
>> >> file is encrypted or is not a database' in
>> >> /home/zbfckla/public_html/Ocx.php:17 Stack trace: #0
>> >> /home/zbfckla/public_html/Ocx.php(17):
>> >> SQLiteDatabase->__construct('library.db') #1 {main} thrown in
>> >> /home/zbfckla/public_html/Ocx.php on line 17
>> >>
>> >>
>> >>
>> >>  Once again I apologies for these silly questions.
>> >>
>> >>  Aharon
>> >>  _______________________________________________
>> >>  sqlite-users mailing list
>> >>  [hidden email]
>> >>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> >>
>> >
>> >
>> > --
>> > Puneet Kishor http://punkish.eidesis.org/
>> > Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
>> > Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
>> > _______________________________________________
>> > sqlite-users mailing list
>> > [hidden email]
>> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>
>
>

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

Aharon (Rony) Shapira
I tried using PDO as follows :
// create a SQLite3 database file with PDO and return a database handle

try{

$dbHandle = new
PDO('sqlite:'.$_SERVER['DOCUMENT_ROOT'].'/../pdoTutorial.sqlite3');

}catch( PDOException $exception ){

die($exception->getMessage());

}


 but got the following error message:

Fatal error: Class 'PDO' not found in /home/zbfckla/public_html/Ocx.php on
line 14



----- Original Message -----
From: "John Stanton" <[hidden email]>
To: <[hidden email]>; "General Discussion of SQLite Database"
<[hidden email]>
Sent: Sunday, March 09, 2008 6:48 PM
Subject: Re: [sqlite] Beginners bad luck


> PHP has Sqlite V2 embedded.  Use PDO to get Sqlite3.
>
> P Kishor wrote:
>> On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>>
>>>Sorry. When I set $db and use $db the message I get is:
>>>
>>> Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is
>>> not a
>>> database in /home/zbfckla/public_html/Ocx.php on line 49
>>> Could not open database
>>>
>>
>>
>> again, no idea about PHP, but check once again if you can open the db
>> ok from the command line. Also, confirm that the db is not on a
>> network drive.
>>
>> If the db opens ok from the command line, it is some kind of PHP
>> problem. Ask for help on the PHP forum unless a PHP user on this list
>> can help. If the db does not open ok from the command line, the db is
>> really fubar because of "unknown" reasons. Recreate the db and try
>> again.
>>
>> Good luck.
>>
>>
>>
>>>
>>>
>>> ----- Original Message -----
>>> From: "P Kishor" <[hidden email]>
>>> To: "General Discussion of SQLite Database" <[hidden email]>
>>> Sent: Sunday, March 09, 2008 5:02 PM
>>> Subject: Re: [sqlite] Beginners bad luck
>>>
>>>
>>> >I don't know how PHP's db connector works but...
>>> >
>>> > On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>>> >>
>>> >>  I created a simple table named "books" in "library.db".
>>> >>  After entering "select * from books" I saw the data that I put into
>>> >> it.
>>> >>
>>> >>  When trying to access it through php:
>>> >>  $file = "library.db";
>>> >>  // open database file
>>> >>
>>> >>  $handle = sqlite_open($db) or die("Could not open database");
>>> >
>>> > Is that a typo? You are setting $file, but trying to open $db.
>>> >
>>> >
>>> >>
>>> >>  I got the following:
>>> >>
>>> >>  "Could not open database"
>>> >>
>>> >>
>>> >>
>>> >>  When I tried the following:
>>> >>
>>> >>  $file = "library.db";
>>> >>
>>> >>  // create database object
>>> >>
>>> >>  $db = new SQLiteDatabase($file) or die("Could not open database");
>>> >>
>>> >>  I got the following:
>>> >>
>>> >>  Fatal error: Uncaught exception 'SQLiteException' with message
>>> >> 'SQLiteDatabase::__construct() [<a
>>> >> href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]:
>>> >> file is encrypted or is not a database' in
>>> >> /home/zbfckla/public_html/Ocx.php:17 Stack trace: #0
>>> >> /home/zbfckla/public_html/Ocx.php(17):
>>> >> SQLiteDatabase->__construct('library.db') #1 {main} thrown in
>>> >> /home/zbfckla/public_html/Ocx.php on line 17
>>> >>
>>> >>
>>> >>
>>> >>  Once again I apologies for these silly questions.
>>> >>
>>> >>  Aharon
>>> >>  _______________________________________________
>>> >>  sqlite-users mailing list
>>> >>  [hidden email]
>>> >>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>> >>
>>> >
>>> >
>>> > --
>>> > Puneet Kishor http://punkish.eidesis.org/
>>> > Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
>>> > Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
>>> > _______________________________________________
>>> > sqlite-users mailing list
>>> > [hidden email]
>>> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>
>>>
>>
>>
>>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

Aharon (Rony) Shapira
In reply to this post by John Stanton-3
Great. PHP has sqlite2 as you said. I could use it to create a db and add a
table. But when downloaded from the server to my pc couldn't get hold of it.
I have a command-line program for accessing and modifying SQLite3 databases
which seems not to recognise it. How do I get one for sqlite2?
Thanks a lot

----- Original Message -----
From: "John Stanton" <[hidden email]>
To: <[hidden email]>; "General Discussion of SQLite Database"
<[hidden email]>
Sent: Sunday, March 09, 2008 6:48 PM
Subject: Re: [sqlite] Beginners bad luck


> PHP has Sqlite V2 embedded.  Use PDO to get Sqlite3.
>
> P Kishor wrote:
>> On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>>
>>>Sorry. When I set $db and use $db the message I get is:
>>>
>>> Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is
>>> not a
>>> database in /home/zbfckla/public_html/Ocx.php on line 49
>>> Could not open database
>>>
>>
>>
>> again, no idea about PHP, but check once again if you can open the db
>> ok from the command line. Also, confirm that the db is not on a
>> network drive.
>>
>> If the db opens ok from the command line, it is some kind of PHP
>> problem. Ask for help on the PHP forum unless a PHP user on this list
>> can help. If the db does not open ok from the command line, the db is
>> really fubar because of "unknown" reasons. Recreate the db and try
>> again.
>>
>> Good luck.
>>
>>
>>
>>>
>>>
>>> ----- Original Message -----
>>> From: "P Kishor" <[hidden email]>
>>> To: "General Discussion of SQLite Database" <[hidden email]>
>>> Sent: Sunday, March 09, 2008 5:02 PM
>>> Subject: Re: [sqlite] Beginners bad luck
>>>
>>>
>>> >I don't know how PHP's db connector works but...
>>> >
>>> > On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>>> >>
>>> >>  I created a simple table named "books" in "library.db".
>>> >>  After entering "select * from books" I saw the data that I put into
>>> >> it.
>>> >>
>>> >>  When trying to access it through php:
>>> >>  $file = "library.db";
>>> >>  // open database file
>>> >>
>>> >>  $handle = sqlite_open($db) or die("Could not open database");
>>> >
>>> > Is that a typo? You are setting $file, but trying to open $db.
>>> >
>>> >
>>> >>
>>> >>  I got the following:
>>> >>
>>> >>  "Could not open database"
>>> >>
>>> >>
>>> >>
>>> >>  When I tried the following:
>>> >>
>>> >>  $file = "library.db";
>>> >>
>>> >>  // create database object
>>> >>
>>> >>  $db = new SQLiteDatabase($file) or die("Could not open database");
>>> >>
>>> >>  I got the following:
>>> >>
>>> >>  Fatal error: Uncaught exception 'SQLiteException' with message
>>> >> 'SQLiteDatabase::__construct() [<a
>>> >> href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]:
>>> >> file is encrypted or is not a database' in
>>> >> /home/zbfckla/public_html/Ocx.php:17 Stack trace: #0
>>> >> /home/zbfckla/public_html/Ocx.php(17):
>>> >> SQLiteDatabase->__construct('library.db') #1 {main} thrown in
>>> >> /home/zbfckla/public_html/Ocx.php on line 17
>>> >>
>>> >>
>>> >>
>>> >>  Once again I apologies for these silly questions.
>>> >>
>>> >>  Aharon
>>> >>  _______________________________________________
>>> >>  sqlite-users mailing list
>>> >>  [hidden email]
>>> >>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>> >>
>>> >
>>> >
>>> > --
>>> > Puneet Kishor http://punkish.eidesis.org/
>>> > Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
>>> > Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
>>> > _______________________________________________
>>> > sqlite-users mailing list
>>> > [hidden email]
>>> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>
>>>
>>
>>
>>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

John Stanton-3
I haven't tried to get it but I understand the Sqlite.org CVS server has
it archived.  You should also be able to create the DB from PHP.  Sqlite
open creates a DB if the file does not exist.

Aharon (Rony) Shapira wrote:

> Great. PHP has sqlite2 as you said. I could use it to create a db and add a
> table. But when downloaded from the server to my pc couldn't get hold of it.
> I have a command-line program for accessing and modifying SQLite3 databases
> which seems not to recognise it. How do I get one for sqlite2?
> Thanks a lot
>
> ----- Original Message -----
> From: "John Stanton" <[hidden email]>
> To: <[hidden email]>; "General Discussion of SQLite Database"
> <[hidden email]>
> Sent: Sunday, March 09, 2008 6:48 PM
> Subject: Re: [sqlite] Beginners bad luck
>
>
>
>>PHP has Sqlite V2 embedded.  Use PDO to get Sqlite3.
>>
>>P Kishor wrote:
>>
>>>On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>>>
>>>
>>>>Sorry. When I set $db and use $db the message I get is:
>>>>
>>>>Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is
>>>>not a
>>>>database in /home/zbfckla/public_html/Ocx.php on line 49
>>>>Could not open database
>>>>
>>>
>>>
>>>again, no idea about PHP, but check once again if you can open the db
>>>ok from the command line. Also, confirm that the db is not on a
>>>network drive.
>>>
>>>If the db opens ok from the command line, it is some kind of PHP
>>>problem. Ask for help on the PHP forum unless a PHP user on this list
>>>can help. If the db does not open ok from the command line, the db is
>>>really fubar because of "unknown" reasons. Recreate the db and try
>>>again.
>>>
>>>Good luck.
>>>
>>>
>>>
>>>
>>>>
>>>>----- Original Message -----
>>>>From: "P Kishor" <[hidden email]>
>>>>To: "General Discussion of SQLite Database" <[hidden email]>
>>>>Sent: Sunday, March 09, 2008 5:02 PM
>>>>Subject: Re: [sqlite] Beginners bad luck
>>>>
>>>>
>>>>
>>>>>I don't know how PHP's db connector works but...
>>>>>
>>>>>On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>>>>>
>>>>>> I created a simple table named "books" in "library.db".
>>>>>> After entering "select * from books" I saw the data that I put into
>>>>>>it.
>>>>>>
>>>>>> When trying to access it through php:
>>>>>> $file = "library.db";
>>>>>> // open database file
>>>>>>
>>>>>> $handle = sqlite_open($db) or die("Could not open database");
>>>>>
>>>>>Is that a typo? You are setting $file, but trying to open $db.
>>>>>
>>>>>
>>>>>
>>>>>> I got the following:
>>>>>>
>>>>>> "Could not open database"
>>>>>>
>>>>>>
>>>>>>
>>>>>> When I tried the following:
>>>>>>
>>>>>> $file = "library.db";
>>>>>>
>>>>>> // create database object
>>>>>>
>>>>>> $db = new SQLiteDatabase($file) or die("Could not open database");
>>>>>>
>>>>>> I got the following:
>>>>>>
>>>>>> Fatal error: Uncaught exception 'SQLiteException' with message
>>>>>>'SQLiteDatabase::__construct() [<a
>>>>>>href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]:
>>>>>>file is encrypted or is not a database' in
>>>>>>/home/zbfckla/public_html/Ocx.php:17 Stack trace: #0
>>>>>>/home/zbfckla/public_html/Ocx.php(17):
>>>>>>SQLiteDatabase->__construct('library.db') #1 {main} thrown in
>>>>>>/home/zbfckla/public_html/Ocx.php on line 17
>>>>>>
>>>>>>
>>>>>>
>>>>>> Once again I apologies for these silly questions.
>>>>>>
>>>>>> Aharon
>>>>>> _______________________________________________
>>>>>> sqlite-users mailing list
>>>>>> [hidden email]
>>>>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>Puneet Kishor http://punkish.eidesis.org/
>>>>>Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
>>>>>Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
>>>>>_______________________________________________
>>>>>sqlite-users mailing list
>>>>>[hidden email]
>>>>>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>>
>>>>
>>>
>>>
>>_______________________________________________
>>sqlite-users mailing list
>>[hidden email]
>>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

John Stanton-3
In reply to this post by Aharon (Rony) Shapira
Looks like you need to recompile PHP with the option.

Aharon (Rony) Shapira wrote:

> I tried using PDO as follows :
> // create a SQLite3 database file with PDO and return a database handle
>
> try{
>
> $dbHandle = new
> PDO('sqlite:'.$_SERVER['DOCUMENT_ROOT'].'/../pdoTutorial.sqlite3');
>
> }catch( PDOException $exception ){
>
> die($exception->getMessage());
>
> }
>
>
>  but got the following error message:
>
> Fatal error: Class 'PDO' not found in /home/zbfckla/public_html/Ocx.php on
> line 14
>
>
>
> ----- Original Message -----
> From: "John Stanton" <[hidden email]>
> To: <[hidden email]>; "General Discussion of SQLite Database"
> <[hidden email]>
> Sent: Sunday, March 09, 2008 6:48 PM
> Subject: Re: [sqlite] Beginners bad luck
>
>
>
>>PHP has Sqlite V2 embedded.  Use PDO to get Sqlite3.
>>
>>P Kishor wrote:
>>
>>>On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>>>
>>>
>>>>Sorry. When I set $db and use $db the message I get is:
>>>>
>>>>Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is
>>>>not a
>>>>database in /home/zbfckla/public_html/Ocx.php on line 49
>>>>Could not open database
>>>>
>>>
>>>
>>>again, no idea about PHP, but check once again if you can open the db
>>>ok from the command line. Also, confirm that the db is not on a
>>>network drive.
>>>
>>>If the db opens ok from the command line, it is some kind of PHP
>>>problem. Ask for help on the PHP forum unless a PHP user on this list
>>>can help. If the db does not open ok from the command line, the db is
>>>really fubar because of "unknown" reasons. Recreate the db and try
>>>again.
>>>
>>>Good luck.
>>>
>>>
>>>
>>>
>>>>
>>>>----- Original Message -----
>>>>From: "P Kishor" <[hidden email]>
>>>>To: "General Discussion of SQLite Database" <[hidden email]>
>>>>Sent: Sunday, March 09, 2008 5:02 PM
>>>>Subject: Re: [sqlite] Beginners bad luck
>>>>
>>>>
>>>>
>>>>>I don't know how PHP's db connector works but...
>>>>>
>>>>>On 3/9/08, Aharon (Rony) Shapira <[hidden email]> wrote:
>>>>>
>>>>>> I created a simple table named "books" in "library.db".
>>>>>> After entering "select * from books" I saw the data that I put into
>>>>>>it.
>>>>>>
>>>>>> When trying to access it through php:
>>>>>> $file = "library.db";
>>>>>> // open database file
>>>>>>
>>>>>> $handle = sqlite_open($db) or die("Could not open database");
>>>>>
>>>>>Is that a typo? You are setting $file, but trying to open $db.
>>>>>
>>>>>
>>>>>
>>>>>> I got the following:
>>>>>>
>>>>>> "Could not open database"
>>>>>>
>>>>>>
>>>>>>
>>>>>> When I tried the following:
>>>>>>
>>>>>> $file = "library.db";
>>>>>>
>>>>>> // create database object
>>>>>>
>>>>>> $db = new SQLiteDatabase($file) or die("Could not open database");
>>>>>>
>>>>>> I got the following:
>>>>>>
>>>>>> Fatal error: Uncaught exception 'SQLiteException' with message
>>>>>>'SQLiteDatabase::__construct() [<a
>>>>>>href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]:
>>>>>>file is encrypted or is not a database' in
>>>>>>/home/zbfckla/public_html/Ocx.php:17 Stack trace: #0
>>>>>>/home/zbfckla/public_html/Ocx.php(17):
>>>>>>SQLiteDatabase->__construct('library.db') #1 {main} thrown in
>>>>>>/home/zbfckla/public_html/Ocx.php on line 17
>>>>>>
>>>>>>
>>>>>>
>>>>>> Once again I apologies for these silly questions.
>>>>>>
>>>>>> Aharon
>>>>>> _______________________________________________
>>>>>> sqlite-users mailing list
>>>>>> [hidden email]
>>>>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>Puneet Kishor http://punkish.eidesis.org/
>>>>>Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
>>>>>Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
>>>>>_______________________________________________
>>>>>sqlite-users mailing list
>>>>>[hidden email]
>>>>>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>>
>>>>
>>>
>>>
>>_______________________________________________
>>sqlite-users mailing list
>>[hidden email]
>>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

Eugene Wee
In reply to this post by Aharon (Rony) Shapira
Hi,

It looks like the PDO extension was not installed/enabled. This is a
little unusual since "PDO ships with PHP 5.1", according to the PHP Manual.

I suggest that you install and enable the PDO extension. Read:
http://www.php.net/manual/en/ref.pdo.php
http://www.php.net/manual/en/ref.pdo-sqlite.php

Regards,
Eugene Wee

Aharon (Rony) Shapira wrote:

> I tried using PDO as follows :
> // create a SQLite3 database file with PDO and return a database handle
>
> try{
>
> $dbHandle = new
> PDO('sqlite:'.$_SERVER['DOCUMENT_ROOT'].'/../pdoTutorial.sqlite3');
>
> }catch( PDOException $exception ){
>
> die($exception->getMessage());
>
> }
>
>
>  but got the following error message:
>
> Fatal error: Class 'PDO' not found in /home/zbfckla/public_html/Ocx.php on
> line 14
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

Edward Macnaghten
In reply to this post by Aharon (Rony) Shapira
Aharon (Rony) Shapira wrote:
> <snip>
>  

> $db = new SQLiteDatabase($file) or die("Could not open database");
>
> I got the following:
>
> Fatal error: Uncaught exception 'SQLiteException' with message 'SQLiteDatabase::__construct() [<a href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]: file is encrypted or is not a database' in /home/zbfckla/public_html/Ocx.php:17 Stack trace: #0 /home/zbfckla/public_html/Ocx.php(17): SQLiteDatabase->__construct('library.db') #1 {main} thrown in /home/zbfckla/public_html/Ocx.php on line 17
>
>
>  

Could this be Apache permissions?

Is the directory/file world readable and writable?  Remember APACHE
normaly runs as user NOBODY so permissions usually need to be chmod to
666 (or 777 for DIRs) for files (or directories) that need to be written to

Eddy
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

Robert L Cochran
In reply to this post by Aharon (Rony) Shapira
When you call phpinfo(); do you see that the PDO functionality is enabled?

Is SQLite listed as one of the databases?

http://us.php.net/manual/en/function.phpinfo.php

Also look at your /etc/php.ini file. Assuming your binary of php is
using extensions, are the extensions for sqlite being loaded? You have
to enable them from php.ini.

Finally, you need to use the pdo syntax -- another poster pointed you to
that.

Instead of PHP, you might want to try using the Catalyst framework to
help you get an SQLite-enabled website going. http://catalyst.perl.org/
for further info, and be sure to follow the Catalyst tutorial. One
problem here is that Catalyst itself is very difficult to install and
the plugins needed for the Catlyst Tutorial are harder. In fact I think
PHP might be easier to compile, but then using Zend Framework is
terribly difficult.

Best Regards

Bob Cochran
Greenbelt, Maryland, USA



Aharon (Rony) Shapira wrote:

> I created a simple table named "books" in "library.db".
> After entering "select * from books" I saw the data that I put into it.
>
> When trying to access it through php:
> $file = "library.db";
> // open database file
>
> $handle = sqlite_open($db) or die("Could not open database");
>
> I got the following:
>
> "Could not open database"
>
>
>
> When I tried the following:
>
> $file = "library.db";
>
> // create database object
>
> $db = new SQLiteDatabase($file) or die("Could not open database");
>
> I got the following:
>
> Fatal error: Uncaught exception 'SQLiteException' with message 'SQLiteDatabase::__construct() [<a href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]: file is encrypted or is not a database' in /home/zbfckla/public_html/Ocx.php:17 Stack trace: #0 /home/zbfckla/public_html/Ocx.php(17): SQLiteDatabase->__construct('library.db') #1 {main} thrown in /home/zbfckla/public_html/Ocx.php on line 17
>
>
>
> Once again I apologies for these silly questions.
>
> Aharon
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>  
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Beginners bad luck

Aharon (Rony) Shapira
The problem was solved by Shibu Narayanan that gave me a link to older
versions of sqlite.
Thanks to you all for the effort.
I guess that beginners do have good luck after all.
Aharon

----- Original Message -----
From: "Robert L Cochran" <[hidden email]>
To: "General Discussion of SQLite Database" <[hidden email]>
Sent: Monday, March 10, 2008 2:42 AM
Subject: Re: [sqlite] Beginners bad luck


> When you call phpinfo(); do you see that the PDO functionality is enabled?
>
> Is SQLite listed as one of the databases?
>
> http://us.php.net/manual/en/function.phpinfo.php
>
> Also look at your /etc/php.ini file. Assuming your binary of php is
> using extensions, are the extensions for sqlite being loaded? You have
> to enable them from php.ini.
>
> Finally, you need to use the pdo syntax -- another poster pointed you to
> that.
>
> Instead of PHP, you might want to try using the Catalyst framework to
> help you get an SQLite-enabled website going. http://catalyst.perl.org/
> for further info, and be sure to follow the Catalyst tutorial. One
> problem here is that Catalyst itself is very difficult to install and
> the plugins needed for the Catlyst Tutorial are harder. In fact I think
> PHP might be easier to compile, but then using Zend Framework is
> terribly difficult.
>
> Best Regards
>
> Bob Cochran
> Greenbelt, Maryland, USA
>
>
>
> Aharon (Rony) Shapira wrote:
>> I created a simple table named "books" in "library.db".
>> After entering "select * from books" I saw the data that I put into it.
>>
>> When trying to access it through php:
>> $file = "library.db";
>> // open database file
>>
>> $handle = sqlite_open($db) or die("Could not open database");
>>
>> I got the following:
>>
>> "Could not open database"
>>
>>
>>
>> When I tried the following:
>>
>> $file = "library.db";
>>
>> // create database object
>>
>> $db = new SQLiteDatabase($file) or die("Could not open database");
>>
>> I got the following:
>>
>> Fatal error: Uncaught exception 'SQLiteException' with message
>> 'SQLiteDatabase::__construct() [<a
>> href='function.SQLiteDatabase---construct'>function.SQLiteDatabase---construct</a>]:
>> file is encrypted or is not a database' in
>> /home/zbfckla/public_html/Ocx.php:17 Stack trace: #0
>> /home/zbfckla/public_html/Ocx.php(17):
>> SQLiteDatabase->__construct('library.db') #1 {main} thrown in
>> /home/zbfckla/public_html/Ocx.php on line 17
>>
>>
>>
>> Once again I apologies for these silly questions.
>>
>> Aharon
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email]
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users