i use phonegap for my application. i create sqlite database and copied it on memory card.
Is it possible to read data from the database on a memory card
thank you and sorry for my poor english.
No. You can't read the database from a custom path. The PhoneGap/Cordova expects the database to be in particular location. If not present, it will create a new database.
But you can move the content to the expected location and start working on it.
Some links to help are:
http://www.raymondcamden.com/2012/7/27/Guest-Blog-Post-Shipping-a-populated-SQLite-DB-with-PhoneGap
http://gauravstomar.blogspot.in/2011/08/prepopulate-sqlite-in-phonegap.html
Related
I was just looking for some guidance with my app design. I'm going to have a local sqllite database pre populated with about 1000 records.
These records will need to be read frequently within the app to update the UI.
The records will need to be updated from within the app.
Is a local mysql database the best way to do this or should I be storing all this info in a massive lua table? The database has 2 tables one with 2 columns and one with 10 columns.
I don't want the data to be accessible from outside the app as some of the data is going to be paid for content.
How would I go about releasing updates in the future? If I upgrade my app to version 2 and add new records to the database... how would I go about keeping the users existing data in the database and just adding the updated stuff?
Hope someone can point me in the right direction!
Many Thanks,
Krivvenz.
I think this is fairly simple question. If you need to use data after closing and opening the app you will need sqlite. If the data is created and lost after the app usage, then a table will do. However, the sqlite has also the advantage of querying, deleting and so many other functions without loops etc that you may need to do in tables manually.
You can also append further data during app update. The Sqlite file you create is saved to document directory. That is not deleted if you only update. Simply write a code in your update that reads the existing database and appends the new data. Or create a new file for sqlite and use the old one as backup.
What would be the better Idea to store Images ? Is it Database (or) any hosting ?
(or) Is there any other idea to store images using ASP.net.
The standard answer is to use both; database holds the location of the files and the file server holds the actual data.
The main advantages of doing this are listed in Store pictures as files or in the database for a web app?
If you are using SQL Server and version 2008 or higher then its worth to store image in file stream. It contains both advantage of storing image in files and database.
Here you can find more information about it from following links.
http://technet.microsoft.com/en-us/library/bb933993(v=sql.105).aspx
http://www.codeproject.com/Articles/128657/How-Do-I-Use-SQL-File-Stream
Regards,
I want to provide iCloud support for my wrapper around sqlite. Is not using coredata.
I wonder how enable iCloud for it. The database content is changed all the time (is for invoicing). Also, if is possible to have some kind of versioning will be great.
Exist any sample I can use to do this?
The short answer is no, you would need to use Core Data as you suspected. Apple has stated that sqlite is unsupported.
Edit: Check out the section on iCloud that's now in the iOS Application Programming Guide under Using iCloud in Conjunction with Databases
Using iCloud with a SQLite database is possible only if your app uses
Core Data to manage that database. Accessing live database files in
iCloud using the SQLite interfaces is not supported and will likely
corrupt your database. However, you can create a Core Data store based
on SQLite as long as you follow a few extra steps when setting up your
Core Data structures. You can also continue to use other types of Core
Data stores—that is, stores not based on SQLite—without any special
modifications.
You can't just put the SQLite database in the iCloud container, because it might get corrupted. (As you modify an SQLite DB, temporary files are created and renamed, so if the sync process starts copying those files, you'll get a corrupt database.)
If you don't want to move to Core Data, you can do what Core Data does: store your database in your document folder, and store a transaction log in the iCould container. Every time you change the database, you add those changes to a log file, so you can play them back and make equivalent changes on other devices.
This gets pretty complicated: aside from getting the log/reply logic right, you'll want to coalesce redundant changes and periodically collapse the log into a complete copy of the database.
You might have an easier time developing a solution if you can exploit knowledge of your application (Core Data has to solve the problem in the general case). For example, you could save invoices as separate files in the cloud container (text, Property List, XML, JSON, whatever), writing them out as the database changes and only importing ones if the system tells you they were created or changed.
In summary, your choice is either to migrate to Core Data or write a sync solution yourself. Which one is best depends on the particulars of your application.
I want to import csv file(already uploaded in blob storage) in Azure.
For example I have uploaded test.csv on blob storage, now I just want to import that test.csv file in .net(azure) and after importing I will insert that data into azure database. I am using C# .net. Please suggest how can I achieve this. I want to follow below steps:-
Creating a cvs file with all rows.
Upload it as blob.
Parse it with a Worker role and insert it in the sql azure db.
Thanks.
A bit more clarification around your question would be helpful. Are you trying to upload a file to Azure blob storage? Download it from there for your app to consume? What language(s) are you using?
There are plenty of examples of loading files into and pulling them from Azure blob storage using .NET at least a handful for doing it with Java or PHP.
I you can clarify what you're trying to do, I'd be happy to point you at the appropriate ones. :)
-- answer based on comment update --
The steps for retrieving the blob are fairly straight forward:
1) create your Azure storage client using your azure storage credentials
add a using clause:
using Microsoft.WindowsAzure.StorageClient;
get a client for accessing blob storage:
CloudBlobClient tmpClient = new CloudBlobClient("<nameofyourconfigsetting>");
get a referrence to the blob you want to download:
CloudBlob myBlob = tmpClient.GetBlobReference("container/myblob.csv");
2) read the blob & save to a file
myBlob.DownloadToFile("<path>/myblob.csv");
The save location can be the %temp% location or if its a large file you may want to allocate some local storage space and put it there. The other thing you want to keep in mind is that if you are doing this in a role instance, you'll need to make sure you have measures in place to prevent two instances from concurrently trying to process the same file. If the file is small enough, you can probably even keep it as a memory stream and process it that way. If this is the case, you can use the DownloadToStream property of the CloudBlob object.
For additionally reading, I'd recommend checking out the MSDN library for the details on the StorageClient and CloudBlob contains. Additionally, the Windows Azure Platform Training Kit has some good labs to help you get a better understanding of how Azure Storage works.
Im developing art gallery which needs 1000s of images to be uploaded so inserting images in DB won't be feasible. so i want to give link of folder inside db where ultimately images should get stored. plz help.
so inserting images in DB won't be
feasible
Why? Works very nicely. Especially with 2008 where you then dump them into a file system store again transparently.
I have a datas store where I store about 500gb of binary information all stored within the database. No issue at all.
Actually if you are using SQL 2008 you can use the FileStream mechanism, which actually stores the images as files on disk, but can be returned in sql results, so the data is still relational.
But answer aside, there's nothing wrong with storing 1000's of images in the database. But worst case, just store the string link if you really want.. its just that process is a little archaic.
It all depends on the DB that you're using I suppose (you didn't mentioned which you're using)
You can always store a relative path to the image file.
For example you might store images at UNC location of: \\YOUR_SERVER\myApplication\images\image1.png
-> the relative path would just be \myApplication\images\image1.png
(By storing just the relative path to the file, you're isolating the possiblity that you might change the server location in future.)
If you are using Sql Server 2008, then checkout the FileStream feature. More background info here.
One of my sites stores all user uploaded images in sql server and it works great. The only problem I can see if you are using shared hosting where you don't get a large database. Otherwise I think its a great option.