Specify path of sqlite database - database

I'm trying to create a standalone HTML5 document that utilizes SQlite. I want to save the database in the same directory as the html file so that I can access the data on a usb stick from any computer. How do I specify where the database ought to be saved?
This is all I have so far:
var db = window.openDatabase("gtd", "", "GTD 3.0", 1024*1000);

From what I understand, the browser handles how and where the SQLite database is created or read from. Firefox places the SQLite db into a file inside the user's profile folder.
In Firefox the DOM storage data is stored in the webappsstore.sqlite file in the profile folder (there's also chromeappsstore.sqlite file used to store browser's own data, notably for the start page - about:home, but potentially for other internal pages with "about:" URLs).
(from https://developer.mozilla.org/en/DOM/Storage)

Related

Problem with Sqlitedb in winform app deployment

I'm working on winform app using local sqlitedb. I'm able to embedded db to application file when deploy. But I got two problem:
I can find the local.db(DEPLOY type) file but when try to read it using DB Browser, it returned blank db without any data inside. The app itself still working perfectly fine with all data in the .db file. So where can I find the .db file which acture have data inside?
The second problem is. I'm syncing local sqlite database with a remote Google Cloud DB. Everything works on debug but in deployment the sync function can not keep tracking changes in .db file and return 0 changes. I assume it's because in application file, the .db file is blank without any data inside so the sync function can not track and sync 2 databases. I'm using DotMim(0.9.7) to sync.

Best way to store documents ( pdf , word ...) in a database ( postgres 9.4)

Problem :
To save documents such a pdf file or word...
Approach :
but it seems to me not a good idea to store it directly in the database.
I prefer to store only the address of the file in a column and to save the file itself on a folder beside my database.
Todo :
Is there a trick to create a folder beside the database (mdf ldf) and to store the relativly to the mdf I mean (.. /document) for example?
after read all comments
suppose our website is xyz.com/index.html for Production and
xyz.com/Dev/index.html for Development
under this application we would have one folder /Doc
for production application path would be xyz.com/
and Development application path would be xyz.com/Dev/
we will save the path in DB table colummn is DOC/doc1.pdf etc ...
when we bring the data from DB then we have to write a code on client end
that would be application path + DB path in column
for Production path would be xyz.com/DOC/doc1.pdf and
for Development path would be xyz.com/Dev/DOC/doc1.pdf
so you will get always right path to show your doc on websites

How do file objects get stored uploaded from a website

What design is used to store file objects that gets loaded from a website. For instance if I have a website that accepts documents or images. So
Use Case 1.
Users logs in and selects a MS word file on his machine and uploads to the website.
Use Case 2.
User logs in and selects a image on his machine and uploads to the website.
How do I store these file objects in the database
The first step is just getting the file from the AngularJS application to the server. This page talks about sending request to the server from the client and should get you started.
Once you have done that, (assuming you are using PHP) you will need to save the resulting file to the database. This post will get you started with saving files to PostgreSQL, but the details will end up being very specific to your situation:
If you have more questions after reading through those resources please add specific details about your setup to your question.

HTML5 Database Use without Server

Is it possible to use a local database file with html5 without using a server. I would like to create a small application that depends on information from a small database. I do not want to host a server just to pull information. Is it possible to create a database file and pull information from the local files ?
Depends on the following:
The type of application you want to build:
Normal website with some data being pulled from a local storage;
Special purpose hosted website / application with data generated by the user;
Special purpose local application with a dedicated platform (a particular browser) and with access to the browser's non-web API -- in order to access the browser's own persistent storage methods (file storage, SQLite etc.);
Special purpose local application with a dedicated environment -- in order to deploy the application with a local web server and database;
Available options:
Indexed DB
Web Storage
XML files used for storing data and XSLT stylesheets for translating the data into HTML;
Indexed DB and Web Storage ar available in some browsers but you need to make sure the targeted browsers have it. Their features aren't quite as complete and flexible as SQL RDBMSs but they may fit the bill if your application doesn't need all that flexibility.
XML files can contain the data you want to be shown to the user and they can be updated manually (not by the user) or dynamically (by a server script).
For dynamic updating the content of the XML is kept in JavaScript and manipulated / altered (using the XML DOM) and when the session is over the XML content is sent to the server to entirely replace the previous XML file. This works OK if the individual users have a file each and they never write to each other's files.
Reading local files:
Normal file access is prohibited (for security reasons) to all local (JavaScript) code, which means that "having" a file locally implies either downloading it from a known source (a server) or asking the user to offer access to a local file.
Asking the user to offer access to a local file which implies offering the user a "file input" -- like for uploads but without actually uploading the file.
After a file has been selected using FileAPI to read that file should be fairly simple.
This workflow would involve the user "giving" you the database on every page refresh -- but since it's a one page thing it would mean giving you the data on every session as long as your script does not refresh the page.
You can use localstorage but you can run a server from your own computer. You can use Wamp or Xampp. Which use Apache and mysql.
What i'm looking for is a little more robust than a cookie. I am making a web application for a friend that will be 1 page, and have a list of names on the page. The person wants to be able to add names to the list, however they do not want to use a web server. Just want the files locally on a computer so a folder called test-app , with index.html, and possibly a database file that can be stored in the web browser or a way to save information to the web browser for repeated use.

How to embed a SQLite DB (*.db file) to the AIR application?

I want to emded SQLite database (*.db file) to the AIR app, like images, mp3 etc.
This is to ensure that it was impossible to copy my database for other users.
No, you can't. And even if you could package it, the data wouldn't really be protected: since an .air package is in essence nothing more than an enhanced .zip archive, anyone could just extract the database from the .air file.
What you have to do is encrypt your database and protect it with a password so that only authorized users can access the database.
There's ample documentation on how to do this. Here's a tutorial from Adobe to get you started: http://www.adobe.com/devnet/air/flex/quickstart/articles/encrypted_database.html
I think this is not possible. If you embed it to the air file andinstall the AIR app the db will be copied to the installation folder.
You could create the database in the user storage location
var file:File = File.applicationStorageDirectory.resolvePath("name.db");
Users could still navigate in explorer to the file. It will be stored under /users/username/appdata/appname/Local Store
AppData is a hidden folder.

Resources