SQL LITE

Hello everyone, I'm wanting to create a sql database lite for my application to store and retrieve data.  I know very little on the subject and I was wondering if someone can point me in the direction of some great examples or documentation?

Thank you

Scientist

Hello

SQL Lite is easy for the Blackberry.

Here I am attaching some of the classes may b that will help you.

public URI myURI;
myURI = URI.create("file:///SDCard/BlackBerry/Database/"
                    + "DatabaseName.db");
            this.setMyURI(myURI);
    public URI getMyURI() {
        return myURI;
    }

    public void setMyURI(URI myURI) {
        this.myURI = myURI;
    }
//Now generate one class which is having all database table fields
//if you are using 3 tables den u have to make 3 classes

Example

public class Schema {
    Database db;

    public Schema() {
            URI newURI = UiApplication.getUiApplication().getMyURI();
            db = DatabaseFactory.open(newURI);
            Statement user= db.createStatement("CREATE TABLE 'User' ( "
                    + "'ID' INTEGER PRIMARY KEY AUTOINCREMENT," + "'Name' Text," + "'Password' Text," + "'Email' Text)");
            user.prepare();
            user.execute();
            user.close();
//2nd schema
    ......
            db.close();

    }

}

In your main class where you want to insert/change/remove data write these codes

Database dbLink;
URI newURI = UiApplication.getUiApplication().getMyURI();
dbLink = DatabaseFactory.create(newURI);
dbLink.close();
Schema s = new Schema();
db = DatabaseFactory.open(newURI);
String Username = "BB";
String Password = "BlackBerry";
String Email = "";

    Statement st = db.createStatement("INSERT INTO User(Name,Password,Email)"
                + " VALUES ('"
                + Username
                + "','"
                + Password + "','" + Email + "')");
    st.prepare();
    st.execute();

    db.close();

----------------------------------------------------------
feel free to press the congratulations on the left side to thank the user who has helped you.
Please mark as resolved messages if you found a solution.

Tags: BlackBerry Developers

Similar Questions

  • WebWorks and persistent or storage SQL Lite

    Hello

    I'm looking for more help write webworks app for persistent storage or SQL lite storage,

    Anyone can throw some light on this.

    Thank you.

    Hi tububerry,
    You can see https://developer.blackberry.com/html5/apis/Database.html
    https://developer.BlackBerry.com/HTML5/APIs/localStorage.html

    and here's the example source code: http://blog.darkcrimson.com/samples/localdb/darkcrimson_localdb_demo.zip

    A Pham

  • Sql-Lite problem

    I looked at the documentation and many examples, but I can't seem to get my departure from the database sql - lite.

    I created the database in the screen here:

    URI myURI = URI.create("file:///SDCard/flash.sqlite");
    
    d = DatabaseFactory.create(myURI);
    
    d.close();
    

    I tried to register information in the database here:

    URI myURI = URI.create("file:///SDCard/flash.sqlite");
     DatabaseFactory.open(myURI);
    
     Statement st = d.createStatement( "CREATE TABLE 'Restaurant' (  'Experience' TEXT,  )" );
    
     d.createStatement("INSERT INTO Restaurant(Experience) " +
     "VALUES ('message1')");
    
     st.prepare();
     st.execute();
     st.close();
     d.close();
    
     Dialog.alert("Your info was saved!");
    

    Any ideas what im doing wrong?

    Thank you

    Scientist

    It should work

    BCZ I work on dat only.

    You need to do sumthing wrong;

    Just check your code.

    Debug your code you find error wl.

    Try like dat.

    URI myURI = URI.create("file:///SDCard/database/flash.db");
    
  • Question SQL-Lite

    Hello, I was wondering if it would be the right way to implement a database SQL-LITE and if I had to submit my application code runs correctly?

    URI myURI = URI.create("file:///SDCard/flash.db");
    d = DatabaseFactory.create(myURI);
    d.close();
    

    I want to save a database to the SD card and was hoping that this was accomplished over there without any other necessary implementation.  For example whenever I have rn that on the Simulator, I need to create a directory for this database.  What it will be just as easy as this presentation and the database is stored on the sd card?

    Thank you

    Scientist

    Yes, this create a file named flash.db in the SD card, but outside the records.

    To save the file in the folder document from SD card, you can use

    "file:///SDCard/Blackberry/documents"+fileName;

    Hope this helps.

    ------------------------------------------------------------------------------------
    Kudo press to say thank you to the developer.
    Also, press accept it as a button when you got the Solution.

  • Issue of database SQL-lite

    If I created a sql database - lite in my application and the database is created when the application starts, how I would write a condition statement to not recognize the creation of database code?

    Is there a better way to do what I'm trying to do here I saw more?

    Here's my code for creation of data base that I want to only be invoked if the database is not present and must be created:

                      try
            {
                URI myURI = URI.create("file:///SDCard/flash.db");
                d = DatabaseFactory.create(myURI);
                d.close();
            }
            catch(Exception e)
            {
    
            }
    
            try
            {
                URI myURI = URI.create("/SDCard/flash.db");
                d = DatabaseFactory.open(myURI);
                Statement st = d.createStatement("CREATE TABLE 'Restaurant' (  'Experience' TEXT, 'Date' TEXT)");
                st.prepare();
                st.execute();
                st.close();
                d.close();
            }
            catch(Exception e)
            {
    
            }
    

    You must use FileConnection, look at this code example.

            url="file:///SDCard/Databases/flash.db";
            if(f==ok)
            {
                try
                {
                    FileConnection fc=(FileConnection)Connector.open(url, Connector.READ_WRITE);
                    if(!fc.exists())
                    {
                        URI uri=URI.create("file:///SDCard/Databases/flash.db");
                        d=DatabaseFactory.create(uri);
                    }
                    else
                    {
                        Dialog.alert("File Exits! Proceed");
                    }
                    d.close();
                }catch(Exception e)
                {
                    System.out.println(e.getMessage());
                    e.printStackTrace();
                }
       }
    

    ------------------------------------------------------------------------------------
    Kudo press to say thank you to the developer.
    Also, press accept it as a button when you got the Solution.

  • SQL-Lite create Table?

    I am wanting to save a string of text in a sql database - lite which is called "message1."  I press save button to call this code in my interlocutor.

    URI myURI = URI.create("file:///SDCard/flash.db");
    DatabaseFactory.open(myURI);
    Statement st = d.createStatement( "CREATE TABLE Restaurant (Experience TEXT)" );
    Dialog.alert("Here1!");
    st.prepare();
    st.execute();
    st.close();  
    
    Statement st1 = d.createStatement("INSERT INTO Restaurant(Experience) VALUES ('message1')");
    st1.prepare();
    st1.execute();
    st1.close();
    d.close();
    Dialog.alert("Your info was saved!");
    

    I can't even my Dialog statement to appear?  I do something wrong in the line where I create the table?

    Statement st = d.createStatement ('CREATE TABLE Restaurant (experience TEXT)');

    Because when I move the dialog statement before this line... I can see the dialog box

    Database db;
    URI myURI = URI.create("file:///SDCard/flash.db");
    db = DatabaseFactory.open(myURI);
    
    Statement st= db.createStatement("CREATE TABLE 'Restaurant' ( "
                        + "'Experience' TEXT)");
                st.prepare();
                st.execute();
                st.close();
    
                Statement st1 = db.createStatement("INSERT INTO Restaurant(Experience) VALUES ('Message1')");
                st1.prepare();
                st1.execute();
    
    db.close();
    

    I checked the code and its working very well.

    ----------------------------------------------------------
    feel free to press the congratulations on the left side to thank the user who has helped you.
    Please mark as resolved messages if you found a solution.

  • SQL Lite: Cannot write into the error of database readonly on release on appworld sandbox

    Hello

    everything was workin find in development mode, but when I downloaded and run my app from appworld sandbox I get the following error:

    SQLLite:

    "Cannot write to readonly database error"

    Thanks in advance...

    It is a database in your application / folder (i.e. comes your file .bar automatically during the installation)?

    You should not write in the app / folder in your application. This can be done in development mode, but it is intended only as a convenience for certain types of deployment of debugging (if you do not have to copy all the files on each time you make a change).

    If you have data in your application, what needs to be changed after the installation, it must be copied into the app. / data folder when the application first runs (or, at least, when it must first change).

    Information here: https://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.d...

  • Equivalent to SQL Server Compact or SqlLite

    Hi all

    Oracle has an equivalent 'No. Install' DB version comparable to Sql Server Compact or Sql Lite? I can't seem to find anything, but I could be looking right on what is obvious...

    As always, appreciate the info.

    -S

    Scarpacci wrote:

    Oracle has an equivalent 'No. Install' DB version comparable to Sql Server Compact or Sql Lite? I can't seem to find anything, but I could be looking right on what is obvious...

    For mobile and embedded devices, you should look at ten times in Oracle server memory.

    Oracle RDBMS itself is not suitable for these devices. Although both products share some common code in their code bases.

  • After that FF28 installed, my history and bookmarks are missing like #981577 I've tried everything!

    I had this problem for about 5 days, it can happen before then, perhaps as early as 23/04/14 but I'm no good (inoperable cancer) and just started using my laptop about 5 days ago. I became aware of the problems about 5 days ago, in the course of which I tried the search the support forums and Mozilla on the web for clues as to what I can try, where the reference to the #981577 issue, which looks like it could have been written by me (my saved passwords no longer work , and I can't open the modules now, but for the last few days I could use Add-ons-those for sql lite, but I just tried the add-on troubleshooting appearing at the bottom of this page and I can't use it, what happened to me earlier today, when I downloaded an add-on, I clicked on the FF orange button at the top left then click on Add - ons and it goes up to reach the Add-ons Manager, but nothing happens when you click on the add-on that you try to use - if it manifests itself - it shows only a page marker to square with 'Disable' and 'Delete' - I thought that the problem was with the other add-on I tried because he had a year and maybe he just didn't work. Somehow, I think that the Bar Menu of Firefox with button Firefox Orange and other toolbars could be part of the problem. If I click on the Navigation toolbar and click on the Favorites button that I added to the bar, he will fall down and show me bookmark pages (maybe 15) who are not sorted as my lack. If I click on "Show all bookmarks" it opens the window titled LIBRARY which shows on the left side of the screen. Inside of the library window is a toolbar with your gray out/not bkwk use, then organize, then views, then import and backup - a box search Favorites under the microscope. Under the tool bar is a section of the left screen with an icon like a book that reads all the bookmarks, there are no bookmarks listed under this heading, and nothing happens if you click on it, like a button/command. On the right side, there are two sections, the first section on the right side and the upper part under the toolbar is an area with the name and the location of the headers and below show 3 bookmarks recent I've added lately. Just below the previous section is the section name: and then a search box empty. If I click on "Show all" when you work with toolbars, or bookmarks, they somehow default to an empty LIBRARY window. When I click on the area of the history from the Firefox Orange button, it shows several recent sites when I click on Show All - nothing, I come and when I click on bookmarks, there are several Favorites I did appear today, BUT NONE of these bookmarks appear in the "LIBRARY" window when I click Show all. I want to add that I get the same results when I use the touch of Orange Firefox toolbar as opposed to the Menu bar original. I performed all the tasks mentioned in the conversation to question #981577, and for the most part, I repeated the procedure three times each with additional Firefox and put off my pc between the two for good measure. I also used Windows system restore twice with no results, but also try to "downgrade" my version of Firefox at 24 and 27 (which I know is not a recommended step and the first attempt resulted in the download of Firefox 28, which I was already running, and the second time, nothing restored or appeared as if by magic so I did an uninstall and did a clean install of Firefox 28 since the download link on the Mozilla site. There is no indication that the other user support had him issue/ticket answered and resolved. Communication support spans 12/26-12/27/13. I wished that the preceding conversation took place recently, it may indicate a problem with FF28, but I don't know if it was released in December. Here's the issue or the problem of the original poster, and I took all such measures suggested by the the technical support representative who was present.

    I would be so grateful to have my favorites because they are my lifeline, and I think I have / had links more than 3,500. What about my story, I never delete anything (including bookmarks). I know, there are thousands of websites that I saved. This is the issue or the problem of the original poster, and I took all the steps as suggested by the representative of the technical support that helped:
    https://support.Mozilla.org/en-us/questions/981577?ESAB=a & s = Show + All + Bookmarks + Show + History + doesn % 27T + Work & r = 20 & As = & page = 1
    _____________________________________________________________________________________________________________
    "Earlier today, my favorites were there. Later that evening, not there.

    I tried the process of restoring bookmarks, I copied the folder and delete the file of places thing. None of this has worked.

    What's weird, is that if I type something in the URL box that I know is in my favorites, it will be displayed as if it was in the history. But nothing shows in my folder of bookmarks at all.

    I need help on what I tried almost all the ways that I read and nothing brought upward. "And as I said in the title, I have over 800 bookmarks and many of them are work related.
    ____________________________________________________________________________________________________________

    Thanks to everyone who took a peek at my problems with library files, history, bookmarks, downloads and passwords lost or missing after Firefox 28 updated (the automated), especially Michael. Jacky, your suggestion was among the first, I tried more than four days ago, but I re - try each day and twice today (this morning, and after I posted my problem of support here). Unfortunately, whenever I tried it, I need to click on start, and I almost always see the screen flash slightly, then at the top of the window where it says 'Library', I would say something like "the program is not responding" and then... nothing, and nothing on 'My Computer', showed changes. I also used inventory management and maintenance to ensure that the files were in my profile folder, etc. and I kept getting a clean management of sites with depth control and I double checked tables in maintenance of places - both of these programs as well as restoration was recommended in the previous responses to requests for information similar to mine. In addition to restoring my computer, I did a 'Reset' on Firefox that created a new profile name which is used where my FF files are stored. I think that this may have contributed to my eventual success.

    Finally, I tried the thing to save the files in another folder, then change the name of the 'SQL places?' I forgot the second part of the name of the file (I blame my brain tumor for my short term memory problems - really) I think it's the name, so I changed the name. I then clicked on file, then exit and it closed Fire Fox. I was very reluctant to use this method to solve my problems, but after about 4-5 attempts using this, my favorites showed up - not only those who register in the drop-down list and would only save to Favorites sorted in the library, he finally showed not to exactly as it did before the problems. I found that using the bar of removing alternating Menu and looking Orange top button Menu to the left of the screen, it appears that the SQL info flows to two menus in the same way. If I clicked on the Menu of the Orange button, he began by listing 3-4 websites as bookmarks. If I used the Menu toolbar bookmarks button, he would have the Favorites list at the bottom of this flow - on 15 sites (which is crazy for both because I did 4 200 bookmarks). I was so frustrated but clicking on all the bookmarks or history, and the pop - up for library would say "there are no files. I don't really know the final or this answer solved my problems, but I stayed awake almost a whole 4 days awake trying to solve this and now it looks like as I ' ve managed to fix 99.9% and I'm done with it - I can't take more. " I think my brain tumor has increased his own tumor to that - I'm absolutely no COMPUTER expert, that's for sure. Thanks again!

  • WebWorks: Sqlite, Playbook + smart phone

    Hi all

    Thanks in advance,

    Can someone please answer my questions.

    * is sql lite in persistence local webworks for playbook & smart phones

    * How can I access the sqlite Database via the command prompt (or in any other way) in the Playbook and smartphone

    * wht would be the difference html4 web database and sqlite in web works?

    Please answer my questions, I look forward to your response.

    Hello

    (1) Yes

    (2) use the Web Inspector!  I have a blog coming out on this soon, but until then this is how to take advantage of this feature (PlayBook only):

    (a) use the d command line argument when you build your application by using bbwp.exe

    (b) the mode of development and deploy your application on the Simulator/tablet as usual

    (c) launch your app WebWorks

    (d) to a desktop browser, load the IP address of your Tablet/sim followed by port 1337 (for example "192.168.1.7:1337") in the address bar

    e Tablet) Voila - content processing Web Inspector of a direct PlayBook.

    (3) do you mean HTML5 Web DB?  If so, they are in the same.  Web DB interface uses SQLite as internal storage mechanism.

    What type of app you are planning on building?

    See you soon,.

    Adam

  • I can add to this code to create a contact button Add

    I did the tutorial here http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Flex-for-the-BlackBerry-PlayBook-...

    Is it possible to add an employee? If so, what is involved?

    you have to watch where the contact data is stored.  IIRC, its a sql lite DB in this tutorial.

    you would need a class or a function that can read and write to the database sql lite to add to the list.

  • storage base problem edit a field in the database

    Hi all

    In fact, I'm trying to insert the data into a database table using sql lite.

    the code below is I tried to recover the data from the field of basic editing and I'm not

    able to read the values. Is it the correct way to insert the data from the edit field or

    am I missing something or is this the wrong way to insert data in database tables.

    st=db.createStatement("INSERT INTO Personal(name,phone,email,city) VALUES('nameField.getText()','phoneField.getText()','emailField.getText()','cityField.getText()')");
    

    However the code below works fine where I am inserting data in the as shown below

    and I am able to read the data. But the thing I want to read data from the basiceditfield.

    st=db.createStatement("INSERT INTO Personal(name,phone,email,city) VALUES('saran',9036114828,'[email protected]','Bangalore')");
    

    Thanks in advance...

    Change your sql for:

    st=db.createStatement("INSERT INTO Personal(name,phone,email,city) VALUES(" +
    "'" + nameField.getText()  + "'," +
    "'" + phoneField.getText() + "'," +
    "'" + emailField.getText() + "'," +
    "'" + cityField.getText()  + "')");
    
  • Can we create table in RMS

    Hello

    I have just one request. Is it possible to create a table as an employee with several fields such as EmployeeiD, Name, age, etc... in RMS?

    If so then someone can show me how its done?

    Thank you
    Saket

    Four options are available for storage on BB devices:

    (a) RMS - you must serialize

    (b) PersistentStore - storage object-oriented, so that a conversion BOF tables needed

    (c) file connection - necessary serialization

    (d) tables - Sybase iAnywhere, for all current models or SQL-Lite, for OS 5.0 only.

    You can find more information on all these on this forum, in the resources section of the loads blackberrydeveloper.com and take a look on the Sybase website too.

    However if you store only a small amount of personal data, I recommend the persistent store.  Download the developer's Guide, there is a good chapter there on persistent data storage, that describes.  .

  • Can I have my catalog open on several machines at the same time?

    Hello

    I am trying to improve my workflow that I now regularly switch between several machines to do my photo montage. To facilitate this I have moved my catalog to OneDrive and have OneDrive running and synchronized on all machines. Sometimes I let Lightroom open on a machine while I try and continue work on another and I was concerned that this might be a bad idea. Supports the file catalog is open in multiple instances at once or do I close Lightroom on a machine before using another?

    Using an external HARD disk and their transport between machines is not an option for me.

    Thank you.

    No, you can have a catalog open on multiple computers.

    You are responsible for corrupting the catalogue and to lose everything. The database is SQL lite which is single-user...

    You can try your idea of opening and closing on each machine that can work well, people use Dropbox for that. The key is to know when a catalog is closed and stopped being written...

  • Moving MS code of DB scale helps App Server a request?

    We have an application developed using Oracle Forms 10 g / 10 g DB? All our treatment is carried out using SPs. Then they run all on the DB server. Even our inserts/modifications/deletions of a table are handled by the SPs.

    The site with the maximum number of simultaneous users (i.e. users) is one with 100 concurrent users.

    We have potential clients with the requirement of 300 concurrent users. Our application will be able to manage it, since the DB is a single processor with little server memory.

    He suggested moving the SPs to the application server by moving them to the form. Since the OAS has a PL engine they will run in the application server and therefore remove the workload of the DB.

    I don't buy it. My point is, even if the SPs are moved to the server always the SQLs app will run on the DB server, right?

    So what's the advantage?

    It's pretty much boils down to know the capabilities and strengths of the tools you use. Dealing with gigabytes of data and processing, it is clearly not a force of java but would be something of a database is to predict and so must be done in SQL respectively PL/SQL in the database. Construction of dialog boxes would be something that I would not hesitate to implement in SQL;).

    Every Java developer will agree that among other things one of the objectives of the OOP thingie are data and methods of access / manipulate these data must be encapsulated in classes because this ensures the integrity of the data and make your code more reusable. But put the data and procedures to manipulate the data in the database and ensuring the integrity of data and the reusability of the code? Oh my God, how dare I even thought of that! It's much better spread SQL statements in all directions in java or any other language and reinvent the wheel as this will at least ensure that you will keep your job as nobody would maintain that piece of junk.
    If java developers insist that everything is coded into the stored procedures now should be moved in java you should insist that they rip their java classes share, separate the methods given in different classes and make each public static method and each member publicvariable. Once upon a time when data component should be moved from Java to .NET, they would just need to re-implement the data classes in .NET and java logical classes just access the data, as they did before, and they do not need to change the logic of the app at all. If they don't see this seam to do and do not want to implement their classes in this way I wouldn't let him do the same thing to the database;).

    The Gospel of 'independent of the database' application is simply not true. These processing applications of the database as a giant plastic garbage bag where you can shovel in all kinds of garbage as you are not only as (ignoring the fact that you need to separate your waste) their argument: 'Hey, I run on oracle as well as on any other database and thus, you are free to choose your RDBMS' are a lie.

    Take the 'Independently of the databases' Application #1: SAP. The fact that run larger systems SAP on Oracle and Oracle does that aspect 'Independence of the database' as a joke. Of course, you run SAP on SQL * Lite, if and only if you have sessions simultaneous user 0.5 who do 0.3 transactions per year. Everything else will be the application unusable slow no matter what hardware you throw on the server. This is not that "you are free to choose your RDBMS. Well well, not in my book at least.

    just my 23 cents ;)

    see you soon

Maybe you are looking for