I want to connect to a local database with Mathematica. I used DB Browser for SQLite to create the database with a single table and then exported it locally as a .sql file. To access the database I tried the following lines:
Needs["DatabaseLink`"];
OpenSQLConnection[JDBC["SQLite"]]
db = Database`OpenDatabase["C:\\db\\testDB.sql"];
results = Database`QueryDatabase[db, "SELECT * FROM `Table1`"]
The following error is output:
Database`QueryDatabase::stmt: The statement "SELECT * FROM `Table1`" is invalid: "file is encrypted or is not a database".
The testDB.sql file looks like this:
BEGIN TRANSACTION;
CREATE TABLE "Table1" (
`field1` TEXT,
`field2` TEXT,
);
INSERT INTO `Table1` VALUES ('point1','point2');
INSERT INTO `Table1` VALUES ('dot1','dot2');
COMMIT;
Any help will be greatly appreciated. Thx.
Database`*
) deviate considerably from what I am used to. The result of OpenSQLConnection needs to be assigned to a variable which will be used in future access to the database. I would do the 4th line with an SQLExecute. I believe the backticks shouldn't be in that line. $\endgroup$