SQLITE on a network with PB

Just starting out? Need help? Post your questions and find answers here.
loulou2522
Enthusiast
Enthusiast
Posts: 501
Joined: Tue Oct 14, 2014 12:09 pm

SQLITE on a network with PB

Post 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
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: SQLITE on a network with PB

Post 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

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
uweb
User
User
Posts: 98
Joined: Wed Mar 15, 2006 9:40 am
Location: Germany

Re: SQLITE on a network with PB

Post by uweb »

Out of this thread http://forums.purebasic.com/german/view ... 16&t=29971, mk-soft has developed a SQLite server in the German forum - http://forums.purebasic.com/german/view ... =8&t=29974
Please pardon my English, my native tongue is German.
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: SQLITE on a network with PB

Post 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

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: SQLITE on a network with PB

Post 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.
uweb
User
User
Posts: 98
Joined: Wed Mar 15, 2006 9:40 am
Location: Germany

Re: SQLITE on a network with PB

Post 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.
Please pardon my English, my native tongue is German.
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: SQLITE on a network with PB

Post 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.
said
Enthusiast
Enthusiast
Posts: 342
Joined: Thu Apr 14, 2011 6:07 pm

Re: SQLITE on a network with PB

Post 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
Post Reply