It doesn't shows Database Connected or not
I am Using Expo
import * as SQLite from 'expo-sqlite';
const db = SQLite.openDatabase({
name: 'class_finder.db',
location: 'default'
},
() => {
console.log("Database connected!")
}, //on success
error => console.log("Database error", error) //on error
)
useEffect(() => {
db.transaction(function (txn) {
txn.executeSql(
"SELECT name FROM sqlite_master WHERE type='table' AND name='table_user'",
[],
function (tx, res) {
console.log('item:', res.rows.length);
if (res.rows.length == 0) {
txn.executeSql('DROP TABLE IF EXISTS table_user', []);
txn.executeSql(
'CREATE TABLE IF NOT EXISTS table_user(user_id INTEGER PRIMARY KEY AUTOINCREMENT, user_name VARCHAR(20), user_contact INT(10), user_address VARCHAR(255))',
[]
);
}
}
);
});
}, []);
I have tried expo sqlite storage for Connection. But None of them Works. I have installed previous version also but couldnt get solution.
If there is any other way to use sqlite Please let me know