Re: [sqlite] Getting error "file is encrypted or is not a database" when trying simple C example

2014-05-26 Thread Fred Basset
Yes I had done an "apt-get install sqlite" which had installed sqlite2.  I
removed it, installed sqlite3 and all is good now.


On Mon, May 26, 2014 at 8:26 AM, Donald Griggs  wrote:

> Hi Fred,
>
> At the risk of informing you of something you may already know,
> you should be able to convert an sqlite version 2 database to sqlite3
> easily using the command line commands as follows:
>
> sqlite OLD.DB .dump | sqlite3 NEW.DB
>
> http://www.sqlite.org/version3.html
>
>
> Donald
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Getting error "file is encrypted or is not a database" when trying simple C example

2014-05-26 Thread Klaas V
FYI: SQLite2.8.17 for some Linux-versions (and Apple ppc) can be found here:
http://www.rpmfind.net/linux/rpm2html/search.php?query=sqlite2

Perhaps there are applications to convert to a more contemporary format like 
3.8.4.3

 

Kind regards | Cordiali saluti | Vriendelijke groeten | Freundliche Grüsse,
Klaas `Z4us` V, freelance CIO & ICT-consultant, BCNarTOSit
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Getting error "file is encrypted or is not a database" when trying simple C example

2014-05-26 Thread Donald Griggs
Hi Fred,

At the risk of informing you of something you may already know,
you should be able to convert an sqlite version 2 database to sqlite3
easily using the command line commands as follows:

sqlite OLD.DB .dump | sqlite3 NEW.DB

http://www.sqlite.org/version3.html


Donald
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Getting error "file is encrypted or is not a database" when trying simple C example

2014-05-26 Thread RSmith


On 2014/05/25 23:07, Fred Basset wrote:

I am using sqlite3 version 2.8.17 on an Arm Debian Linux system.


There is no SQLite3 version 2.8.17...  it's either SQLite 2 which may have had a version 2.8.17 or SQLite3 which only ever has 
versions 3.n.n.n and for which we still need to get to version 3.8.17 somewhere down the line (current version is only at 3.8.4.n).


So, unless your statement has a typo regarding the version number, you seem to be making DBs in SQLite 2 and trying to open it with 
SQLite 3 - which I assume will always fail as the file architecture is different (though I could be wrong, I only ever used SQLite3 
and have never actually encountered an SQLite2 or earlier DB in the wild).


If this is the issue, the C makefiles etc. are all easily downloadable from the SQLite site so updating the Linux distro to use a 
latest version is easy. If this is a widely deployed thing, it might be less easy, but I can't believe any recent (or even 
not-so-recent) Linux distro would still include an SQLite 2 build, unless I'm very uninformed (which might well be).


Source / Build Files can be found at:
http://www.sqlite.org/download.html



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Getting error "file is encrypted or is not a database" when trying simple C example

2014-05-26 Thread Richard Hipp
On Sun, May 25, 2014 at 5:07 PM, Fred Basset wrote:

> I am using sqlite3 version 2.8.17 on an Arm Debian Linux system.
>

SQLite version 2 and version 3 have incompatible file formats.  You appear
to have created a database using version 2 then tried to read that database
using version 3.

You should use SQLite version 3 exclusively.  SQLite 3 has been the
standard for 10 years.  SQLite3 is used for everything.  Nobody has used
SQLite2 in a very, very long time.



>
> I created a test table using these commands from Linux:
>
> "
> cat 01_create_tables.sql
> CREATE TABLE PV_INTERVALDATA (
>timestamp DATE,
>T_ambient  REALNOT NULL,
>T_trunk1   REALNOT NULL,
>T_trunk4   REALNOT NULL
> );
>
> sqlite < 01_create_tables.sql pvintervaldata.sqlite
> "
>
> I then went to insert a row into the new database with this C code:
>
> "
> #include 
> #include 
>
> static int callback(void *NotUsed, int argc, char **argv, char
> **azColName){
>   int i;
>   for(i=0; i printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
>   }
>   printf("\n");
>   return 0;
> }
>
> int main(int argc, char **argv){
>   sqlite3 *db;
>   char *zErrMsg = 0;
>   int rc;
>
>   rc = sqlite3_open("pvintervaldata.sqlite", );
>   if( rc ){
> fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
> sqlite3_close(db);
> return(1);
>   }
>   rc = sqlite3_exec(db, "insert into PV_INTERVALDATA
> values(datetime('now','localtime'), 24.5, 20, 21);", callback, 0,
> );
>   if( rc!=SQLITE_OK ){
> fprintf(stderr, "SQL error: %s\n", zErrMsg);
> sqlite3_free(zErrMsg);
>   }
>   sqlite3_close(db);
>   return 0;
> }
> "
>
> On running the C program I get this error however:
>
> "
> SQL error: file is encrypted or is not a database
> "
>
> What is going wrong?
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Getting error "file is encrypted or is not a database" when trying simple C example

2014-05-26 Thread Fred Basset
I am using sqlite3 version 2.8.17 on an Arm Debian Linux system.

I created a test table using these commands from Linux:

"
cat 01_create_tables.sql
CREATE TABLE PV_INTERVALDATA (
   timestamp DATE,
   T_ambient  REALNOT NULL,
   T_trunk1   REALNOT NULL,
   T_trunk4   REALNOT NULL
);

sqlite < 01_create_tables.sql pvintervaldata.sqlite
"

I then went to insert a row into the new database with this C code:

"
#include 
#include 

static int callback(void *NotUsed, int argc, char **argv, char **azColName){
  int i;
  for(i=0; i