I am using sqlite in my app, i want to edit some data in my database,for that i want to open it using any sqlite administration tool. but i dont know where the file is located.
i am workring in windows phone 7
If you want to get the database that is stored in your emulator then you can use the "Isolated Storage Explorer".
Just follow the instructions on the link below and it will show you how to retrieve/save the database from/to your emulator
Isolated Storage Explorer
As ry8806 said. it worked for me
i did the following ;
get my app Product id from WMAppManifest.xml file
then open "Program Files\Microsoft SDKs\Windows Phone\v7.1\Tools\IsolatedStorageExplorerTool" in command line and
typed : ISETool.exe ts xd (Product GUID) (desktop-path)
I get all the files stored in isolated stroge.
Related
I'm posting this to assist users who will be encountering the same thing I did when trying to locate a sqlite database being used on the iOS simulator when using Appcelerator.
xCode Version: 8.3.x
Appcelerator Studio: 4.8.x / SDK: 6.x
Issue/Test Case: I need to test several iterations of loading data from the sqlite database to a remote mySQL server. I want to place an existing sqlite database file in the folder and have the simulator recognize this file so I can use it for testing/development.
Question: Where is the sqlite database stored on the iOS simulator, can I place an existing sqlite database in this folder and have my app recognize it?
Answer: Yes
Steps to achieve:
This is what I did to locate where the simulator/device is looking for
1. Find out where your application is located in the filesystem by adding this code in your index.js (or another file of your choosing).
Ti.API.info("app directory: " + Ti.Filesystem.applicationDataDirectory);
This will give you the long filesystem directory location:
/Users/[username]/Library/Developer/CoreSimulator/Devices/96662E38-C659-4568-B53F-C32DC6B2B73D/data/Containers/Data/Application/96662E38-C659-4568-B53F-C32AB6B2C03D /Documents/
2. This was almost the correct location but the sqlite database is actually stored in the following location:
/Users/[username]/Library/Developer/CoreSimulator/Devices/96662E38-C659-4568-B53F-C32DC6B2B73D/data/Containers/Data/Application/96662E38-C659-4568-B53F-C32AB6B2C03D /Library/Private Documents/[filename].sql
3. You can use this location to put an existing sqlite database file and execute sql statements against it.
4. I'm sure you could reference another directory in your app but I was looking for the default storage directory since my app uses this location.
Hope this helps someone, as I was looking for this specific functionality for testing/development.
Happy Coding!
An easy way to get the database included is to simply add it to the resources folder, or a sub folder in the resources directory. Then you simply call the Ti.Database.install() method. This will copy the database into the simulator location you found. The upside with this method is that you don't have find the location for each iOS simulator (i.e. iPhone 5, 6, 6 plus, 7...).
I do use your method when I need to query the database externally with SQLite manager or another such program.
You can read more here http://docs.appcelerator.com/platform/latest/#!/guide/Working_with_a_SQLite_Database
I have a list view in my app, some data is saving to the database before populating list view.
My problem is that can't see the data, and how to verify the data is stored in the database.
I am giving the solution for Visual Studio 2015 (worked for Xamarin).
Locate the database file mentioned in above image, and click on Pull button as it shown in image 2.
Save the file in your desired location.
You can open that file using SQLite Studio or DB Browser for SQLite to verify your data is saved.
You can use use a SQLite browser, such as the open-source multi-platform DB Browser for SQLite, or another tool of your choice.
Getting access to the sqlite file is the next thing:
iOS Simulator:
/Users/administrator/Library/Application Support/iPhone Simulator
You can browse simulator files from that directory in Mac OS X.
Android Emulator:
You can use the command line via adb shell command for browsing file system:
ls - list current directory
cd - change current directory
Once you find the Sqlite file for your app, you can use the pull cmd for copying the file from device (or emulator image):
adb pull /sdcard/file.txt file.txt
I solved this problem in a few steps:
On Windows:
Download a SQLite viewer, for example SQLiteStudio.
Find where the .db or .db3 file is stored, i did it this way:
var databasePath = Path.Combine(FileSystem.AppDataDirectory, "localDB.db3");
Console.WriteLine(databasePath);
For me the path was: /data/user/0/com.companyname.[name]/files/localDB.db3
Find where the Android Debug Bridge (adb) .exe is stored. For me it was stored at: C:\Users[user]\AppData\Local\Android\Sdk\platform-tools. (AppData is a hidden folder, so make sure that hidden folders are visible.
Open a command prompt at this folder.
Try to copy the database file to a local folder on your machine by entering the following line into the command prompt:
adb pull [path to database] [path to local folder]
results in:
adb pull /data/user/0/com.companyname.[name]/files/localDB.db3 C:\Users\[user]\Desktop
If you get an error "Failed to stat remote object ... Permission denied", you have to make sure you have root permission. To do this, enter the following line in the command prompt:
adb root
Try to copy the file again.
If the file is succesfully copied, open it with SQLiteStudio.
et voila
Here is how you can access the sqlite database file in xamarin forms using Rider IDE:
Set your db path
private string GetDatabasePath()
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "db.db");
}
Logging Environment.GetFolderPath(Environment.SpecialFolder.Personal) prints this path on my device
/data/user/0/com.companyname.landpriceexplorer/files
Click the Device File Explorer tab on the right side.
Search for the database file in the device file explorer.
Double click the file to add to the data source.
Open the Database tab and browse your data there.
I have a database from an existing android app that I need to import into my Windows Phone 8 app. Is the only way to do this to create some huge population script to be ran on the first loading of the app?
I am currently using the new sqlite-net-wp8 by Peter Huene as directed by this blog post. But the examples are all about creating the database, not using an existing one. Any help would be great.
This link shows how to copy an existing sqlite database in Windows 8. The ability to do it on a phone is the same.
1) Add the sqlite database into your project and set the type to content in its properties.
2) When your app loads, load the file into a storage file. Then write it back out using the localfolder as the destination.
WP8 only supports local (in local file) databases.
Check your solution and search for database file. If file does't exist then You can only copy by script.
Hi I installed QLite Pro but Im unable to connect to a local SQLite file db how can I do this?
The fields to fill are:
Name:
Host: requeire
UserName:
PassWord:
Database:
Port:
At the end I solved this by using the program DB Browser for SQLite, I also tried the Firefox plugin but this one is better.
You can't! Sequel Pro is only for MySQL databases.
Same problem here, i couldn't make it work.
So I downloaded this firefox plugin: https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/ which works fine.
Here's a small guide on how to open a sqlite database from a app in the iPhone simulator
Run your application on simulator (so that the database file will be copied to your application's documents folder (don't bother if you don't know exactly what it means))
Run the SQLite Manager plugin in Firefox (Tools -> SQLite Manager)
Open the database (You can find the file by navigating: /Libraries/ApplicationSupport/iPhone Simulator/User/Applications/(*number)/Documents
*number is some sequence of hexadecimal numbers identifying current application bundle - you must just find the proper folder (it will contain .app)
It is also possible with database on device, but first you must download application's documents folder to some place on your computer. You can download the folder by going in Xcode -> Organizer, then select your Device and Summary Tab, then under the Applications list find your application, click the triangle |> to expand it, then click the arrow on the right to download the application's documents folder.
Source: http://www.iphonedevsdk.com/forum/iphone-sdk-development/42573-browsing-sqlite3-database.html
Where is the SQLite database stored i.e. directory path on windows 7 when created ?
A SQLite database is a regular file. It is created in your script current directory.
.databases
If you run this command inside SQLite
.databases
it lists the path of all currently connected databases. Sample output:
seq name file
--- --------------- ----------------------------------------------------------
0 main /home/me/a.db
There is no "standard place" for a sqlite database. The file's location is specified to the library, and may be in your home directory, in the invoking program's folder, or any other place.
If it helps, sqlite databases are, by convention, named with a .db file extension.
If you are running Rails (its the default db in Rails) check the {RAILS_ROOT}/config/database.yml file and you will see something like:
database: db/development.sqlite3
This means that it will be in the {RAILS_ROOT}/db directory.
When you call sqlite3_open() you specify the filepath the database is opened from/saved to, if it is not an absolute path it is specified relative to your current working directory.
It depends on how you initialized the database. If you used the command line shell for SQLite (e.g. sqlite3 ex1) to create the database, it'll be a path from the root of your local machine. If you used a Python script to create the database, it'll be a path from your project.
To check the former, run the command line shell:
sqlite3
sqlite> .databases
To check the path in your project, you can print the path in the connection. For example:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DATABASE = 'db'
def get_db_connection():
print(os.path.join(BASE_DIR, DATABASE, "database.db"))
conn = sqlite3.connect(os.path.join(BASE_DIR, DATABASE, "database.db"))
conn.row_factory = sqlite3.Row
return conn
In my case I think it was an access issue. I saved the SQLite files to "C:/Program Files (x86)/sqlite". I CD'd there, ran sqlite3, and created a database called test.db:
As you can see, I ran .database, which told me the .db file was created in the same directory, so I went to confirm in File Explorer, and it wasn't there:
Curiously the database was working correctly in spite of this.
It was only through trial-and-error that I discovered that I could save in some locations, but not others. It appears to me that SQLite can't save to locations that require elevation. In my case, moving from Program Files to My Documents made the issue go away.
I find it quite irritating that SQLite doesn't just tell me "access denied" instead of trying to be clever and saving to some location that I can't even find.
In Windows machines (Windows 2010), by default, the new SQLite database files will be stored in the same folder where Sqlite3.EXE application is stored in your machine. However , we can create a new folder in Windows and within sqlite> prompt, you may use the .cd to change to the new working directory.
It is a good idea to give a .db file extension to the new database files that you create (even though it is not mandatory to have any file extension)
The SQLite command, .databases will show the default database "main" or currently created or currently opened database or all "attached" database files with file path. The .attach is useful to attach more than one database file to the current connection when we want to work with tables belonging to different databases.
Regards,
Biju Joseph N.,
Houston TX, USA (January 12, 2023)
the database path will be displayed, when using .databases
SQLite is created in your python directory where you installed the python.
SQLit Database is simply a file where your local data is stored on your local machine
In Windows 10 if in the prompt command the path where you start sqlite is
C:\users\USER_NAME
You can find it in the user home folder.
The .db file is stored where you start the sqlite command.
I hope this solve the issue