I am developing a playbook app, where I am creating multiple databases. Can I get the location of the file/db created. I need to delete that Database, but I couldn't find a way to drop it, so I am planning to delete the file that it is stored in.
You can't drop SQLite databases, as you have found (hence my suggestion to simply drop all the tables).
However, if you really must delete the physical db file, I think your best bet is to mount the PlayBook's file system, and then track the file down. This link may help in explaining the file system layout on the PlayBook:
http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/BlackBerry-PlayBook-File-System-Layout/ta-p/773327
It depends on the OS and browser you are using, I have no experience with Playbook and its browser, but for example under Windows XP and using Firefox it's stored on:
C:\Documents and Settings\USERNAME\Application Data\Mozilla\Firefox\Profiles\YOURPROFILE
and in Chrome there are two possible places:
C:\Documents and Settings\USERNAME\Local Settings\Application Data\Google\Chrome\User Data\Default\
There you have LocalStorage and Databases folders.
Hope it helps
Related
I have lately re-discovered embedded databases such as Sqlite (sql, relational) and LiteDb (noSql) and I like working with them for small web apps or mobile apps.
However, I cannot find any good answer to where to place them. Where to put them if:
The web app is likely to be containerized
The database can grow dynamically
Changes to the code and new deployments should not risk losing any change in database
1. Database file as part of solution (versioned in source control)
I've seen places where the *.db file is placed somewhere in the solution and it's versioned in source control.
I can see how this could be a problem as the database can be modified outside the context of development (i.e: when the app is up and running in production, the DB may change and in the next deployment the db may be overwritten if no backup/restore process in place)
Sometimes I have seen it inside wwwroot/App_Data. See this for instance. I assume App_Data is some kind of protected folder and its files cannot be server statically by the web server (is it?). Otherwise this is even worse.
2. Database file in binary folder
When testing, it's fine to have the database file generated somewhere in the bin folder, but this causes a similar problem as the previous one. What happens when a new software version is released and therefore the database file is overwritten in production?
So the questions are:
Is there any good practice regarding where to place embedded database files?
Is there any alternative to having backup/restore processes to avoid the described data-loss scenarios?
What happens when the app is contenierized and the database file grows once deployed? If the file is inside a container along with the running application, can it grow indefinitely? I don't recall specifying anything about a maximum size for containers anywhere when creating images..
Is having the DB in an external storage such a cloud blob store the alternative? I'm guessing the real benefit of embedded databases is gone if the file is in a different host.
Any good read about this would be appreciated.
PS:
I am asking for AspNet Core apps mainly because I see some projects using the wwwroot folder to place the embedded DB, but the question applies to any technology/framework.
This other question doesn't help either.
I'm developing an application that uses SQLite for its data files. I'm just linking in the SQLite amalgamation source, using it directly.
If the user chooses to create a new file, I check to see if the file already exists, ask the user if they want to overwrite the file, and delete it if they say yes. Then I call sqlite3_open_v2() with flags set to SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE to create and open the new data file.
Which is fine, except, what happens if a malicious user recreates the file I'm trying to open in between the file being deleted and SQLite opening it? As far as I'm aware, SQLite will just open the existing file.
My program doesn't involve passwords or any kind of security function whatsoever. It's a pretty simple app, all things considered. However, I've read plenty of stories where someone uses a simple app with an obscure bug in it to bypass the security of some system.
So, bottom line, is there a way to make sqlite3_open() fail if the file already exists?
You might be able to patch in support for the O_EXCL option flag of open(2). If you are using SQLite on a platform that supports that.
I'm in need of some help in developing a desktop application with a pre-populated database. I have tried numerous ways to get this working including those mentioned on both Tidesdk's API here http://tidesdk.multipart.net/docs/user-dev/generated/#!/api/Ti.Database.DB and at Titanium Desktops old API here http://developer.appcelerator.com/apidoc/desktop/latest/Titanium.Database-module.
While the later (using Titanium not Ti) works in creating a database in the apps directory it does not install my pre-populated sqlite database which is located in the resources file of my app.
A couple of my attempts located below
var db = Titanium.Database.openFile('test_db.sqlite', 'test_db');
var db = Titanium.Database.openFile(Ti.Filesystem.getFile(
Ti.Filesystem.getApplicationDataDirectory(), 'test_db.sqlite'));
var db = Ti.Database.open('test_db');
As stated most of these manage to create a database with the name given but when trying to run something as simple as a db.execute(SELECT) of something I know would exist in my pre-populated db I receive an error stating
Exception executing: SELECT name, id FROM people ORDER BY name COLLATE NOCASE, Error was: SQL Statement invalid or database missing
I have searched high and low for something to answer this but everyone continues to refer to the aforementioned API's or to the Mobile API's Ti.database.install() which does not work either.
Is it possible with titanium desktop to use a pre-populated sqlite database or do I have to populate it after I create it? If so any direction would be helpful (where to place the .sqlite file in the app and what functions to call).
I am currently using Titanium Studio with a titanium desktop osx SDK of 1.2.0.RC4 as requested by tidesdk.org until they have released there open source sdk.
Thanks in advance
This is possible, I just used this feature in a recent desktop app, deployed it successfully to Windows and Mac.
In my experience, sometimes your database file can be corrupted, for example if you use the Titanium.Database.install command, and it cant find the file to preload from (maybe the first time you specified the path wrong for instance), it will create the file itself, any subsequent install commands will not work because it already thinks this database has been installed.
Have you tried clearing out the application data? This is where titanium installs the database. For Mac this is in your /User/Library/Application Support/APPNAME directory. Their is a directory for databases, delete this and try again.
Also, this answer on Titanium Q&A may help, it talks about the process with the Mobile SDK but the Database stuff is the same.
Hope this helps!
I'm working through the "Demo: Binding Data with the SqlDataSource" of this pluralsight video on ASP.NET Webforms.
All communication with the database works just fine, except it won't change when updates are made. The only thing I've done differently from the video is to use Northwind.sdf instead of Northwind.mdf. The database exists in the project directory, which is under my Users directory on win7 -- so it shouldn't be a permissions problem.
What could be preventing it from updating?
In case anyone wants to try the sample app, I uploaded the whole project folder here on mediafire.
Maybe you have two copies of the database. You are updating copy A and then checking copy B.
Or, it could be one of the reasons described here: http://weblogs.asp.net/stevewellens/archive/2009/10/16/why-sql-updates-fail-three-reasons.aspx
I'm wondering if many users can work on the same Enterprise Architect file ? our professor said it can be done if we can host the file in a repository and then link it to windows ODBC ? I'm not sure what does that means.
There are two ways to set up an EA project: stored in an .EAP file (accessed through the file system), or stored in a database (accessed through ODBC)
The file actually contains a database, and EA provides functionality for migrating both ways between the two.
An .EAP file can be accessed by several users simultaneously (with the file on a network drive), as of course a database can be. In either case, you are strongly encouraged to enable EA's "user security" in order to allow users to lock the parts of the project they are working on so they don't undo each others' changes.
An .EAP file can be used if the team is small. If there are more than 10 of you, you definitely want to set up a database repository.
So yes, several users can work in the same .EAP file. ODBC is a different way of setting it up; there is then no file as such but a database instead.
See Team Modeling Resources for Enterprise Architect.