I am trying to make a cross platform app using a local sqlite db and I got the plumming for IOS and Android set up.
I get to the point where I can get the db using "adb.exe and pull". I use DB browser for Sqlite to view the db file. The file has no tables.
But when I look into the SQLiteConnection in the code I can see the tables and if I query I get data.
Any ideas?
-- update
maybe I shoud mention. I am using Visual Studio with Xamarin forms and sqlite-net-pcl
I think the table exist in the db since you can query data from the table.
Could you try to use another tool to view the DB file instead of DB browser?
And make sure the db you open is the correct one.
Here is a link that might help you:
How to use ADB in Android Studio to view an SQLite DB
Related
I have developed one application in ionic for offline mode. I have used sqlite database to store the data. Now i want to create a browser build. But sqlite is not supported in browser. Is there any way to use sqlite in browser?
Or else is there any database which works same as sqlite for browser.(kindly do not suggest websql database and pouchdb)
i am using pouchdb for now, but there is lots of redevelopment because queries in pouchdb and sqlite are very different
As of this moment there is no way of using SQLite with ionic in the browser. Did you maybe find a solution to your own problem?
For anyone reading this that wants to purely use SQLite in their app (instead of localstorage) you can use a livereload build on a test device and easily debug and test your code this way. Just connect dev tools and see all the console messages.
Evening All,
Working my way through creating my first app using xamarin vs 2017. Have DB tables being created, and CRUD operations being performed in the code.
However, I would like to view the tables. I have found a clip showing how to view SQLite db from windows using command prompt:
https://www.youtube.com/watch?v=wXEZZ2JT3-k
and has worked, so by creating a folder on my desktop I can create a new sqlite3 db, with tables, and then view the tables and schema (please see below)...However this worked because I have the location of the db...How can I obtain the location from my app?...when creating the connection it uses the path:
/data/user/0/com.companyname.TestProjectXamarin/files/TestDB.db3;
What do I need to add to the front of this to obtain the location
Thank You
I'm using a sqlite database linked to my react-native app.
I've already done some queries in my app that work fine, so the query method is good.
Now, I've add new table to the database by adding a csv file in it (as I've already done before).
But when I make a call on the new table, the console tells me that there is 'no such table'.
If I put the sql query in my DB manager, the call do works.
Thanks for your help!
I did find the solution.
It is very simple, just create a new emulator and rerun your app. It seems that Android Studio works on a 'copy' of the project so it does not see the modification in the database.
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!
How can i attach the **database to my activity that i have created in sqlite database browser.
and can i write queries in sqlite database browser and will it run in my activity
See my answer in the following link. I think it will fully solve your problem.
Populating SQLite Database