open an existing sqlite database - HTML5 - database

I am trying to access an sqlite3 DB from an HTML5 page. The DB is found the physical folder. How to open the DB. All the sample in net describes window.openDatabase() method. This is creating a new db instance. How to open an existing database.
thanks in advance
Geervani

When you tried to use "window.openDatabase()" on an existing database, what happens to the data?
My guess is "window.openDatabase()":
creates the DB is not existent,
then use it use it if it exists

Related

Orchard CMS Logging data store in database?

I want to store all my loggign exception data in the database. I can log them in file, but with db , added appender attribute in log4net.config , but no success. Can anybody share some advise ? thanks in advance.
this http://logging.apache.org/log4net/release/config-examples.html has provided almost all databases sample config file to store the logging data into the database table. Run scripts for creating the table and add the config file in the project. Be cautious all the parameter name and layout spelling.
I tested for MS SQL, worked for me and will works for any other databse too.
Happy coding

sqllite database location for codename one

SQL lite created by using the following code
Database db = Database.openOrCreate("test.db");
Its creates the database, after that we created tables on this database. We need to know where is this test.db file stored?.
Note: we are using Net Beans IDE on windows 10 system for our development.
Thanks in advance
This is discussed in the SQL section. You need to use getDatabasePath before opening the database to replace the file with a premade file which I assume is the use case you are aiming at.
We can get the .db file from the path "C:\Users\Admin.cn1\database".

SQLite attach all databases in a directory

Hi I have an sqlite database called 'main.db' where I attach all the databases that are in the directory 'db' (e.g. 'db/db1.db' , 'db/db2.db' and so on).
I would like to know if there is a way to save 'main.db' so that the attachements are remembered across sessions.
Also when in 'main.db' how can I create a new database 'db/db3.db' and have it attached automatically when I open 'main.db'?
I usually use the sqlite3 shell for my databases maintenance.
Attachments are not stored in the database; they are local to a connection.
Any attachments must be done explicitly by the application that has opened the database.

How to use a persistent H2 database in the Play Framework instead of in-memory

The H2 database used in the Java Todo List tutorial is the following:
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
How do I modify the configuration file to use a persistent database as opposed to an in-memory version. Do I need to setup an entirely separate DB or can I modify the db.default.url property?
I'm using Play! 2.0.3.
I found the solution.
To create a file database, modify the following:
From
db.default.url="jdbc:h2:mem:play"
To
db.default.url="jdbc:h2:file:data/db"
Where data/db is broken down into:
data/ The folder location of the database files relative to your project root.
db The name of your database files.

SQLite problem (doesn't update)

I have made an SQLite database file with some testdata in it. When I use it in my application it goes well.
Next I have inserted a new row with data into my table with an SQLite manager. Here's where the problem is. When i run my application now, the new data doesn't appear. It's still all the old data (without the newly inserted one).
Does anyone know why the SQLite file isn't updated (Or maybe it's updated but doesn't show the data)?
Update:
I use the SQLite manager in FireFox.
I've inserted it with that manager, and when i query the select * from table it shows the new data.
I use the following command to open my database
var db = Titanium.Database.install('../test2.sqlite', 'test');
What is the current path when you open the database? ../ refers to the parent folder; are you absolutely certain that is the same folder where you’ve been creating a database using SQLite Manager? SQLite doesn’t error out if you open a non-existing database; it’ll just create a new, empty, one.
Use a full, absolute path, and try again.
this is typically i think. your database seems to be cached. you should change the name
var db = Titanium.Database.install('../test2.sqlite', 'test_v2');
or delete the cached database.
You don't need to rename your database.
You can try to delete the app in your simulator or emulator and install the app again. It worked for me. Since the app still has the old database. Re-installing the app with the new data (i.e. columns, rows). I use SQLite Manager plugin in Firefox as well.

Resources