Page 1 of 1
SQLITE on a network with PB
Posted: Thu Sep 07, 2017 8:14 am
by loulou2522
Hi all
Can someone tell me how to put an sqlite database on a network and being able to have more than one access concurrently in purebasic ?
Thanks in advance
Re: SQLITE on a network with PB
Posted: Thu Sep 07, 2017 8:42 am
by falsam
Hello Loulou.
"
SQLite is not directly comparable to client/server SQL database engines such as MySQL, Oracle, PostgreSQL, or SQL"
Source :
https://sqlite.org/whentouse.html
PureBasic works natively with PostgreSQL. Install PostgreSQL
https://www.postgresql.org/ or
https://www.postgresql.fr
Re: SQLITE on a network with PB
Posted: Thu Sep 07, 2017 8:56 am
by uweb
Re: SQLITE on a network with PB
Posted: Thu Sep 07, 2017 9:32 am
by falsam
I recommend a real SQL connection with PostgreSQL
An example of a connection to a hosted database
Opens a free database (100 Mb) with
this service provider.
Host
postgresql-falsam.alwaysdata.net
Port
5432
User
falsamdemo (Read Only :p)
Password
falsamdemo
Code: Select all
Enumeration
#Database
EndEnumeration
UsePostgreSQLDatabase()
If OpenDatabase(#Database, "host=postgresql-falsam.alwaysdata.net port=5432 dbname=falsam_01", "falsamdemo", "falsamdemo", #PB_Database_PostgreSQL)
Debug "Connected to PostgreSQL"
Else
Debug "Ooops !! Not connected to PostgreSQL"
EndIf
Re: SQLITE on a network with PB
Posted: Fri Sep 08, 2017 1:56 pm
by Kukulkan
Putting the above answers together, I strongly recommend to NOT use sqlite in a network environment. It is designed as a local desktop database. If you use it through network connections and multi-client, trouble is guaranteed.
Please have a look at PostgreSQL, MariaDB, MySQL or others. This is the only correct solution for distributed clients accessing a central SQL database. Maybe, if applicable, you can also try to utilize new No-SQL databases like CouchDB or MongoDB. Some of them offer HTTP access and this can be done using PB native connectivity functions.
Re: SQLITE on a network with PB
Posted: Fri Sep 08, 2017 3:22 pm
by uweb
Correct, unless there are reasons for this, e.g. if you need a portable ad-hoc SQL Server, which should also have custom functions, stored procedures, or filters.
I have assumed that he has a reason for it.
After all, he asked for sqlite in a network environment.
Re: SQLITE on a network with PB
Posted: Fri Sep 08, 2017 3:46 pm
by Kukulkan
uweb wrote:Correct, unless there are reasons for this...
I fully agree. Except of this, SQLite says it very clearly on their website:
https://sqlite.org/whentouse.html:
SQLite wrote:
Situations Where A Client/Server RDBMS May Work Better
Client/Server Applications
If there are many client programs sending SQL to the same database over a network, then use a client/server database engine instead of SQLite.
Re: SQLITE on a network with PB
Posted: Fri Sep 08, 2017 8:24 pm
by said
From SQLite doc
SQLite supports an unlimited number of simultaneous readers, but it will only allow one writer at any instant in time ...
https://sqlite.org/whentouse.html