(no subject)

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

(no subject)

larshgf
Hi SQLite-users,

I have in the console prg (cmd) created a small database in SQLite with only
one table (just in order to check out SQLite). The Table is defined like
this:

CREATE TABLE IF NOT EXISTS "Gloser"(
GRAESK VARCHAR(50) NULL,
DANSK VARCHAR(50) NULL,
LEKTION VARCHAR(10) NULL,
NOTE TEXT NULL
);

As a programming language I use Delphi 10.2 (GUI Object Pascal) and their
FireDAC components for handling SQLite.
When I (in my Delphi program) try to write to the database like this:

fdqFlashCard.Append;
fdqFlashCard.FieldByName('GRAESK').AsString:= 'græsk';
fdqFlashCard.FieldByName('DANSK').AsString:= 'dansk';
fdqFlashCard.FieldByName('LEKTION').AsString:= 'lektion';
fdqFlashCard.Post;

Then I get this error:

[FireDAC][Phys][SQLite]ERROR: Attempt to write a readonly database

I have been searching without a result. Anybody with a helping hint?

BR Lars

 

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

Re: [EXTERNAL] (no subject)

Hick Gunter
This sounds like a windows file access problem that is not letting your application access a file created in the context of a cmd box. Can you - from the sqlite shell - insert the desired record into the database? And select it afterwards? If so, then SQlite is working perfectly and it is your OS Setup that is in the way.

If you can't write to the database from the SQLite shell, then maybe your are in a read-only directory. Try creating a temp table (which should default to an in-memory database) and iserting/selecting there.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Lars Frederiksen
Gesendet: Freitag, 10. August 2018 11:42
An: 'SQLite mailing list' <[hidden email]>
Betreff: [EXTERNAL] [sqlite] (no subject)

Hi SQLite-users,

I have in the console prg (cmd) created a small database in SQLite with only one table (just in order to check out SQLite). The Table is defined like
this:

CREATE TABLE IF NOT EXISTS "Gloser"(
GRAESK VARCHAR(50) NULL,
DANSK VARCHAR(50) NULL,
LEKTION VARCHAR(10) NULL,
NOTE TEXT NULL
);

As a programming language I use Delphi 10.2 (GUI Object Pascal) and their FireDAC components for handling SQLite.
When I (in my Delphi program) try to write to the database like this:

fdqFlashCard.Append;
fdqFlashCard.FieldByName('GRAESK').AsString:= 'græsk'; fdqFlashCard.FieldByName('DANSK').AsString:= 'dansk'; fdqFlashCard.FieldByName('LEKTION').AsString:= 'lektion'; fdqFlashCard.Post;

Then I get this error:

[FireDAC][Phys][SQLite]ERROR: Attempt to write a readonly database

I have been searching without a result. Anybody with a helping hint?

BR Lars



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


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] (no subject)

larshgf
In CMD I can write to my database without problems. Can you give me a hint about what might be wrong with my OS-setup in Windows 10?
Thank you for the answer and your help! Much appreciated!

Best Regards
Lars


-----Oprindelig meddelelse-----
Fra: sqlite-users [mailto:[hidden email]] På vegne af Hick Gunter
Sendt: 10. august 2018 11:55
Til: 'SQLite mailing list'
Emne: Re: [sqlite] [EXTERNAL] (no subject)

This sounds like a windows file access problem that is not letting your application access a file created in the context of a cmd box. Can you - from the sqlite shell - insert the desired record into the database? And select it afterwards? If so, then SQlite is working perfectly and it is your OS Setup that is in the way.

If you can't write to the database from the SQLite shell, then maybe your are in a read-only directory. Try creating a temp table (which should default to an in-memory database) and iserting/selecting there.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Lars Frederiksen
Gesendet: Freitag, 10. August 2018 11:42
An: 'SQLite mailing list' <[hidden email]>
Betreff: [EXTERNAL] [sqlite] (no subject)

Hi SQLite-users,

I have in the console prg (cmd) created a small database in SQLite with only one table (just in order to check out SQLite). The Table is defined like
this:

CREATE TABLE IF NOT EXISTS "Gloser"(
GRAESK VARCHAR(50) NULL,
DANSK VARCHAR(50) NULL,
LEKTION VARCHAR(10) NULL,
NOTE TEXT NULL
);

As a programming language I use Delphi 10.2 (GUI Object Pascal) and their FireDAC components for handling SQLite.
When I (in my Delphi program) try to write to the database like this:

fdqFlashCard.Append;
fdqFlashCard.FieldByName('GRAESK').AsString:= 'græsk'; fdqFlashCard.FieldByName('DANSK').AsString:= 'dansk'; fdqFlashCard.FieldByName('LEKTION').AsString:= 'lektion'; fdqFlashCard.Post;

Then I get this error:

[FireDAC][Phys][SQLite]ERROR: Attempt to write a readonly database

I have been searching without a result. Anybody with a helping hint?

BR Lars



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


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

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

Re: [EXTERNAL] (no subject)

Hick Gunter
Sorry I don't do Windows System Management. You need to take this question to a windows developer support group.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Lars Frederiksen
Gesendet: Freitag, 10. August 2018 12:08
An: 'SQLite mailing list' <[hidden email]>
Betreff: Re: [sqlite] [EXTERNAL] (no subject)

In CMD I can write to my database without problems. Can you give me a hint about what might be wrong with my OS-setup in Windows 10?
Thank you for the answer and your help! Much appreciated!

Best Regards
Lars


-----Oprindelig meddelelse-----
Fra: sqlite-users [mailto:[hidden email]] På vegne af Hick Gunter
Sendt: 10. august 2018 11:55
Til: 'SQLite mailing list'
Emne: Re: [sqlite] [EXTERNAL] (no subject)

This sounds like a windows file access problem that is not letting your application access a file created in the context of a cmd box. Can you - from the sqlite shell - insert the desired record into the database? And select it afterwards? If so, then SQlite is working perfectly and it is your OS Setup that is in the way.

If you can't write to the database from the SQLite shell, then maybe your are in a read-only directory. Try creating a temp table (which should default to an in-memory database) and iserting/selecting there.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Lars Frederiksen
Gesendet: Freitag, 10. August 2018 11:42
An: 'SQLite mailing list' <[hidden email]>
Betreff: [EXTERNAL] [sqlite] (no subject)

Hi SQLite-users,

I have in the console prg (cmd) created a small database in SQLite with only one table (just in order to check out SQLite). The Table is defined like
this:

CREATE TABLE IF NOT EXISTS "Gloser"(
GRAESK VARCHAR(50) NULL,
DANSK VARCHAR(50) NULL,
LEKTION VARCHAR(10) NULL,
NOTE TEXT NULL
);

As a programming language I use Delphi 10.2 (GUI Object Pascal) and their FireDAC components for handling SQLite.
When I (in my Delphi program) try to write to the database like this:

fdqFlashCard.Append;
fdqFlashCard.FieldByName('GRAESK').AsString:= 'græsk'; fdqFlashCard.FieldByName('DANSK').AsString:= 'dansk'; fdqFlashCard.FieldByName('LEKTION').AsString:= 'lektion'; fdqFlashCard.Post;

Then I get this error:

[FireDAC][Phys][SQLite]ERROR: Attempt to write a readonly database

I have been searching without a result. Anybody with a helping hint?

BR Lars



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


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

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


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] (no subject)

R Smith-2
In reply to this post by larshgf
On 2018/08/10 12:07 PM, Lars Frederiksen wrote:
> In CMD I can write to my database without problems. Can you give me a hint about what might be wrong with my OS-setup in Windows 10?
> Thank you for the answer and your help! Much appreciated!

Usually the FireDAC connections work fine out the box, especially for
SQLite (though I suggest using your own latest DLL which can be
downloaded from sqlite.org).

There are 2 typical reasons why a file can have locking difficulty in
Windows:
1 - Windows UAC is virtualizing the folder your DB is in (did you
perhaps put it in the same folder as the exe? Or any other
Windows-system folder?), or
2 - An over-zealous anti-virus is locking the file.

Now I'm having difficulty believing it's 2, because the DB is not "Busy"
or erroring out when opening, it's "Read-Only" which isn't an automatic
switch for sqlite itself or via FireDAC.

I'm also confident it's not 1 because the Windows UAC virtualization
could move the file, could even redirect to a folder where the file
doesn't exist, but I have never experienced it causing the file to open
in read-only mode in sqlite.

This leaves only the FireDAC component itself. Perhaps it has read-only
mode set in either the properties or connection parameters - could you
post for us your exact set-up of the FireDac connection? (Just say which
controls you've used and their properties, view the form as text and
copy it if needed).

Just to be sure it isn't the UAC, try and connect to an sqlite DB or
file in a safe location (such as your documents folder), see if you have
any luck.

These things usually work rather easy and straight-forward - so I'm
betting it's something small that's perhaps not obvious.


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

Re: [EXTERNAL] (no subject)

larshgf
Hi,
Right now I am not by my PC so I am not able to show you the settings in my FireDAC. Hovever I found some kind of solution to my problem before "closing down" yesterday:
A few days ago I created my flashcard.db database in the sqlite console prg located in a folder named C:/SQLite/. From here it was copied to a folder where my program exe-file is placed when I develop. Using flashcard.db from this folder gave the mentioned error. After changing the connection link to C:/SQLite/ the error disappeared and I was able to write to the database.
I have to find out why it works like that!

UNICODE problem:
Besides this problem I have another one being not able to show greek characters (unicode) when I insert records in the database. In the console cmd-prompt the greek characters shows like questionmarks.
 
Best Regards
Lars

-----Oprindelig meddelelse-----
Fra: sqlite-users [mailto:[hidden email]] På vegne af R Smith
Sendt: 10. august 2018 20:06
Til: [hidden email]
Emne: Re: [sqlite] [EXTERNAL] (no subject)

On 2018/08/10 12:07 PM, Lars Frederiksen wrote:
> In CMD I can write to my database without problems. Can you give me a hint about what might be wrong with my OS-setup in Windows 10?
> Thank you for the answer and your help! Much appreciated!

Usually the FireDAC connections work fine out the box, especially for
SQLite (though I suggest using your own latest DLL which can be
downloaded from sqlite.org).

There are 2 typical reasons why a file can have locking difficulty in
Windows:
1 - Windows UAC is virtualizing the folder your DB is in (did you
perhaps put it in the same folder as the exe? Or any other
Windows-system folder?), or
2 - An over-zealous anti-virus is locking the file.

Now I'm having difficulty believing it's 2, because the DB is not "Busy"
or erroring out when opening, it's "Read-Only" which isn't an automatic
switch for sqlite itself or via FireDAC.

I'm also confident it's not 1 because the Windows UAC virtualization
could move the file, could even redirect to a folder where the file
doesn't exist, but I have never experienced it causing the file to open
in read-only mode in sqlite.

This leaves only the FireDAC component itself. Perhaps it has read-only
mode set in either the properties or connection parameters - could you
post for us your exact set-up of the FireDac connection? (Just say which
controls you've used and their properties, view the form as text and
copy it if needed).

Just to be sure it isn't the UAC, try and connect to an sqlite DB or
file in a safe location (such as your documents folder), see if you have
any luck.

These things usually work rather easy and straight-forward - so I'm
betting it's something small that's perhaps not obvious.


Cheers,
Ryan
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

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

Re: [EXTERNAL] (no subject)

Richard Damon
If you program is installed in the Program Files folder, then you should
NOT put any data files that need to be we written to (like a database)
in that directory, as it is a violation of Microsoft protection rules.
Only privileged programs  are allowed to write to files in the program
files directory tree.

That is the Windows UAC comment below. Depending on how the file is
accessed and how the program presents itself to the OS affects how the
virtualization works. As I remember, if the program acts old, Windows
will create a virtual version of the file (to maintain compatibility
with ancient programs written before the rule change), but if it acts
new, it gets the write permission error because it should know better.

On 8/10/18 9:43 PM, Lars Frederiksen wrote:

> Hi,
> Right now I am not by my PC so I am not able to show you the settings in my FireDAC. Hovever I found some kind of solution to my problem before "closing down" yesterday:
> A few days ago I created my flashcard.db database in the sqlite console prg located in a folder named C:/SQLite/. From here it was copied to a folder where my program exe-file is placed when I develop. Using flashcard.db from this folder gave the mentioned error. After changing the connection link to C:/SQLite/ the error disappeared and I was able to write to the database.
> I have to find out why it works like that!
>
> UNICODE problem:
> Besides this problem I have another one being not able to show greek characters (unicode) when I insert records in the database. In the console cmd-prompt the greek characters shows like questionmarks.
>  
> Best Regards
> Lars
>
> -----Oprindelig meddelelse-----
> Fra: sqlite-users [mailto:[hidden email]] På vegne af R Smith
> Sendt: 10. august 2018 20:06
> Til: [hidden email]
> Emne: Re: [sqlite] [EXTERNAL] (no subject)
>
> On 2018/08/10 12:07 PM, Lars Frederiksen wrote:
>> In CMD I can write to my database without problems. Can you give me a hint about what might be wrong with my OS-setup in Windows 10?
>> Thank you for the answer and your help! Much appreciated!
> Usually the FireDAC connections work fine out the box, especially for
> SQLite (though I suggest using your own latest DLL which can be
> downloaded from sqlite.org).
>
> There are 2 typical reasons why a file can have locking difficulty in
> Windows:
> 1 - Windows UAC is virtualizing the folder your DB is in (did you
> perhaps put it in the same folder as the exe? Or any other
> Windows-system folder?), or
> 2 - An over-zealous anti-virus is locking the file.
>
> Now I'm having difficulty believing it's 2, because the DB is not "Busy"
> or erroring out when opening, it's "Read-Only" which isn't an automatic
> switch for sqlite itself or via FireDAC.
>
> I'm also confident it's not 1 because the Windows UAC virtualization
> could move the file, could even redirect to a folder where the file
> doesn't exist, but I have never experienced it causing the file to open
> in read-only mode in sqlite.
>
> This leaves only the FireDAC component itself. Perhaps it has read-only
> mode set in either the properties or connection parameters - could you
> post for us your exact set-up of the FireDac connection? (Just say which
> controls you've used and their properties, view the form as text and
> copy it if needed).
>
> Just to be sure it isn't the UAC, try and connect to an sqlite DB or
> file in a safe location (such as your documents folder), see if you have
> any luck.
>
> These things usually work rather easy and straight-forward - so I'm
> betting it's something small that's perhaps not obvious.
>
>
> Cheers,
> Ryan
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


--
Richard Damon

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

Re: [EXTERNAL] (no subject)

larshgf
In reply to this post by R Smith-2
Hi Ryan,

In the meantime I solved my unicode problem by simply setting FDConnection.StringFormat = unicode (I thought it was the default value but in my environment I have to choose it actively. (I could also solve the problem by choosing to use NVARCR instead of VARCHR)
So here are my FDConnction1, fdqGloser (FDQuery) and dsGloser (DataSource):

  object FDConnection1: TFDConnection
    Params.Strings = (
      'Database=C:\SQLite\flashcard.db' // THIS WAS CHANGED...  (read only problem solved)
      'StringFormat=Unicode' // THIS WAS CHANGED... (unicode problem solved)
      'DriverID=SQLite')
    LoginPrompt = False
    Left = 36
    Top = 104
  end
  object fdqGloser: TFDQuery
    Connection = FDConnection1
    SQL.Strings = (
      'SELECT * FROM Gloser')
    Left = 116
    Top = 104
  end
  object dsGloser: TDataSource
    DataSet = fdqGloser
    Left = 196
    Top = 104
  end

Thank you for the help so far.
BR Lars

-----Oprindelig meddelelse-----
Fra: sqlite-users [mailto:[hidden email]] På vegne af R Smith
Sendt: 10. august 2018 20:06
Til: [hidden email]
Emne: Re: [sqlite] [EXTERNAL] (no subject)

On 2018/08/10 12:07 PM, Lars Frederiksen wrote:
> In CMD I can write to my database without problems. Can you give me a hint about what might be wrong with my OS-setup in Windows 10?
> Thank you for the answer and your help! Much appreciated!

Usually the FireDAC connections work fine out the box, especially for
SQLite (though I suggest using your own latest DLL which can be
downloaded from sqlite.org).

There are 2 typical reasons why a file can have locking difficulty in
Windows:
1 - Windows UAC is virtualizing the folder your DB is in (did you
perhaps put it in the same folder as the exe? Or any other
Windows-system folder?), or
2 - An over-zealous anti-virus is locking the file.

Now I'm having difficulty believing it's 2, because the DB is not "Busy"
or erroring out when opening, it's "Read-Only" which isn't an automatic
switch for sqlite itself or via FireDAC.

I'm also confident it's not 1 because the Windows UAC virtualization
could move the file, could even redirect to a folder where the file
doesn't exist, but I have never experienced it causing the file to open
in read-only mode in sqlite.

This leaves only the FireDAC component itself. Perhaps it has read-only
mode set in either the properties or connection parameters - could you
post for us your exact set-up of the FireDac connection? (Just say which
controls you've used and their properties, view the form as text and
copy it if needed).

Just to be sure it isn't the UAC, try and connect to an sqlite DB or
file in a safe location (such as your documents folder), see if you have
any luck.

These things usually work rather easy and straight-forward - so I'm
betting it's something small that's perhaps not obvious.


Cheers,
Ryan
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

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