I am using R to create a database, and then ingest data into this database. I am using a Linux VM to perform these operations, and have tried the operations with R 3.4.4 and R 3.6.3. The relevant code is:
sqlDatabase = file.path(results_folder, 'mix_database.db')
sqlConnection = dbConnect(RSQLite::SQLite(), sqlDatabase)
dbCreateTable(conn=sqlConnection,
name='mix',
fields=c(
'id'='integer',
'x'='numeric',
'y'='numeric'
)
)
Here results_folder is simply an output from file.path(...). The failure occurs in the dbCreateTable command. After starting with no database file, the sqlConnection command creates a mix_database.db file, and then dbCreateTable command should create a table within this database. However, I am getting the following error:
> dbCreateTable(conn=sqlConnection,
name='mix',
fields=c(
'id'='integer',
'x'='numeric',
'y'='numeric'
)
)
Error: database is locked
I have a couple questions. First, has anyone else experienced this? If so, how can I solve this? Is there a way to unlock a database within R?