Welcome Guest, Not a member yet? Register   Sign In
Connection different kind of database
#1

Hello

I would like to create an application where the database is mysql or sqlite  (maybe other)
What is your advice for that.
can I use .env like this

#uncomment this part if you want mysql
#database.default.hostname = localhost
#database.default.database = 
#database.default.username =
#database.default.password =
#database.default.DBDriver = MySQLi

# database
database.database.database = '../writable/db/db1.db'
database.database.DBDriver = 'SQLite3'


Do you have other suggestion or idea
Reply
#2

(This post was last modified: 06-06-2022, 10:47 AM by captain-sensible. Edit Reason: extra )

for config i just put my data straight in /app/Config/Database.php as follows:


Code:
public $default = [
        'DSN'      => '',
        'hostname' => 'localhost',
        'username' => '',
        'password' => '',
        'database' => ROOTPATH.'writable/Art',
        'DBDriver' => 'SQLite3',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'cacheOn'  => false,
        'cacheDir' => '',
        'charset'  => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 3306,
    ];

i've seen different naming for sqlite files eg databasefile.db mine is just called "Art" and the file is in the writable Directory . That obviously makes since since data must be written to the database.
I use sqlite both in localhost and live ; i've had no issues of any kind including security. MySQL or Maria by the way offers no extra security say where its used with Wordpress because although in theory there is a user and passpword set up for MySQl ; the way Wordpress works, this makes no diffrence since its possible to just evoke WP to divulge eg admin user name which are stored in the database used by WP.

The capacity of sqlite is more than big enough for web having capacity of 256 tebibytes but the best thing about sqlite being written with C from memory is that its just a file and requires no daemon. So you can just develop Ci4 on your Desktop using spark if you want.


Also if you want to see whats populated or even directly edit you can use : https://sqlitebrowser.org/


At least on Linux you can. To "see" and find my sqlite database i have to use "all files"
CMS CI4     I use Arch Linux by the way 

Reply




Theme © iAndrew 2016 - Forum software by © MyBB