Insertion of data in blackberry java database

Here is my code to insert data into the database

package mypackage;

import net.rim.device.api.database.Database;
import net.rim.device.api.database.DatabaseFactory;
import net.rim.device.api.database.Statement;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.RichTextField;
import net.rim.device.api.ui.container.MainScreen;

//class untuk insert data ke database table People

class InsertDataScreen extends MainScreen
    Database d;
    public InsertDataScreen()
        LabelField title = new LabelField("SQLite Insert Data " +
                                          "Schema Sample",
                                          LabelField.ELLIPSIS |
        add(new RichTextField("Attempting to insert data into " +
                               "MyTestDatabase.db on the SDCard."));
            URI myURI = URI.create("file:///Store/Databases/SQLite_Guide/" +
            d =;

            Statement st = d.createStatement("INSERT INTO People(Name,Age) " +
                                             "VALUES ('John',37)");
            add(new RichTextField("inserting data successful"));
            System.out.println( "inserting data successful" );
        catch ( Exception e )
            System.out.println( e.getMessage() );


I checked this database is exist. When I run the above code, my data has been never inserted in the database, code bellows

add(new RichTextField("inserting data successful"));

never called.

Anyone know what is my fault? Please

Problem solved!

I have successfully insert data and view the database when I change the location of storage on SD card

I don't know why, but its probably that blackberry can't save the SQLite database on internal memory (OS7)

Tags: BlackBerry Developers

Similar Questions

  • Insert XML data into the MySQL database

    Hi all, I'm new with XML and I need help with the insertion of XML data in the mysql database using coldfusion. I looked on the Coldfusion Documentation and saw how to convert XML to a Coldfusion query... but there was no example of how to do an insert. If anyone can give me a good example or point me towards a good direction on how to do it, I would really appreciate it.

    Thank you very much in advance

    Nevermind, I finally managed to do work!

  • Insert a date in the MySQL database

    I have a problem to enter a date in my database using Dreamweaver.
    I enter the current date in a session variable. It seems OK; When I echo the date, is correct.
    Then I get the date in the database (see attached programme).
    At run time, there is no error message.
    But when I display the date using PHPMyAdmin, the date is set to zero.
    I don't understand.
    Could someone help me?
    Thank you.

    Thank you.
    I found the solution.
    To be inserted into a MySQL database, the date format must be A-m-j.
    It was my mistake.
    Kind regards.

  • insert excel data sheet in the database

    Hello friends

    I have an excel file and I want to insert this file into the database can I do? .. . If yes then please tell me how can I do it in a few steps very simple like m beginner in oracle
    Thanks in advance

    Convert csv file and load it using sql loader.

  • Receive 'database is locked' or "database is null or closed" when inserting the data.

    Using a Bold 9700 device and 9700 OS JDE 5.0.0 Simulator, I found that when I insert data in a loop, I'm back is:

    1. 'database is locked'
    2. "database is null or closed"

    Maybe it's in my design the way I am inserting data, because I am inserting data in two tables in a SQLite database since in a loop and nested loops.

    I have JSON data that looks like:

    "product": {
    "id": "3459200",
    "label": "coffee",
    "brand": "Folgers"
    "distance": "local",
    "flavors": [
          "aroma": "Hazelnut",
          "id": 10,
          "aroma": "Columbia",
          "id": 12,
          "aroma": "French Vanilla",
          "id": 14,

    Values produces JSON objects, id, label, brand, and distance to go in a single table. The values in the array JSON flavors go in another table, as well as the id.

    Therefore, I have a table that has:

    • product
    • ID
    • label
    • brand
    • distance

    Another table:

    • aroma
    • ID
    • fk_id

    When I loop through the JSON data, I am currently:

    1. Open a database connection
    2. Perform the insert in a while loop for JSON objects
    3. Use a loop through the JSON array and passing nested in the database, a connection
    4. Leave the nested loop
    5. Exit the loop
    6. Close the database connection a finally statement.

    I don't:

    1. Open a database connection
    2. Perform the Insert
    3. Close the connection of database for each JSON object and the JSON object in the JSON array.

    Is what I do now correct or is there a better way to insert in the database and to manage effectively the database connection in order to avoid the 'database is locked' or "database is null or closed" message?

    Thank you.


    The call to close can be eliminated completely.  If you want to call it, it will have to be outside the loop.  The following link explains.

    Cursor.Close () closes the statement used to create this

    You can find sample code for multiple inserts here:

  • Date time format BlackBerry java application

    Hi all

    I'll have a Date format time as ' 2013-10 - 09T 12: 45:00 + 05:30 '. How can I convert in ' hh: mm a "or" hh: mm a "in my Blackberry Java Application.

    Thank you and best regards.

    I will not be able to solve this problem using techniques integrated... In any case I analyzed it manually...

    Thankng you all for you answer!

  • How to insert CLOB data in tha table in my database

    I create a table called (annual NUMBER, name VARCHAR and CLOB doc) html page

    IsqlPlus I have run the following procedure

    P4_FIRE_HTML_TRIGGER_ARG EXEC ("OLBA + LEGAL + PSOA + OEJN", file);  file: came the CLOB parameter

    the result parameter is set to the queue:
    < ! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 / / IN" "http://..." >
    < HTML >
    < HEAD >
    < TITLE > ADDS - METARS results form < / TITLE >
    "< LINK REL ="StyleSheet"type =" text/css"HREF="/layout/awc/mystyle.css ">
    < / HEAD >
    < TABLE SUMMARY = "this table is used for formatting only" BORDER = 0 CELLPADDING = 3 CELLSPACING = 0 >
    < TR VALIGN = "top" >
    < TD ALIGN = "left" COLSPAN = "2" >
    < H2 > Aviation digital data Service (ADDS) < / H2 >
    Produced by form of METAR (1858 & #160;) 11 February 2014 UTC) < BR >
    " located at < A HREF =" http://AV .............................
    < Table >
    < /TR >
    < TR VALIGN = "top" >
    < TD ALIGN = "left" COLSPAN = "2" >
    < FONT FACE = "Monospace, Courier" > OLBA 111800Z 01006KT 7000 FEW026 16/11 Q1022 < / POLICE > < BR >
    < FONT FACE = "Monospace, Courier" > LEGAL 111830Z 34005KT 8000 NSC 13/11 Q1021 NOSIG < / POLICE > < BR >
    < FONT FACE = "Monospace, Courier" > PSOA 111830Z 21009KT 9999 - RA BKN016 06/03 Q1003 NOSIG < / POLICE > < BR >
    < FONT FACE = "Monospace, Courier" > OEJN 111800Z 34004KT CAVOK 25/20 Q1012 NOSIG < / POLICE > < BR >
    < Table >
    < /TR >
    < /table >
    < / BODY >
    < / HTML >

    I try inserting the above result in my HtmlPage of the table by a simple insert:
    Values inserted INTO HTMLPAGE (annual, doc)
    (5, 'meatr_taf', ' <!) DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 / / IN" "http://... "
    ... < / HTML > ') values are not inserted just I got a message:
    SP2-0863: iSQL * more treatment

    Can someone help me to insert CLOB data in my table HtmlPage above
    Thank you


    Form [32 bit] Version (Production), oracle JInitiator: Version, WebUtil Version 1.0.2 (Beta), window xp service pack 2 build 2600, Internet Explorer 8

    p2_putlines (File_Metar);
    USING_CLOB. ADD_MORE (1, File_Metar);
    USING_CLOB. LOB_INS (1, 'Metar_taf', File_Metar);

    You should not use USING_CLOB. LOB_INS (1, 'Metar_taf', File_Metar) inside the Loop.You must use



    p2_putlines (File_Metar);

    USING_CLOB. ADD_MORE (1, File_Metar);


  • Pushing data from a Java application * confused *.

    Hello community,

    I'm new to the BlackBerry Push. I tried to understand what options are available to provide data to a Java application and how it can be tested.

    There are so many documents on this subject, for example:

    1. Push for the BlackBerry Enterprise Server software
    2. BlackBerry Push service
    3. Push blackBerry SDK service

    What I discovered thanks to these documents.

    1. There are two formats that can be used to send data through the BES (PAP push / push RIM)
    2. BlackBerry Push service has two levels (BB push Essentials / BB push more - limited to 8 KB content)
    3. In the Push Service SDK, there are two modes available (public and business mode)

    For me, these information are really confusing.

    What I don't understand:

    I. can the software of the BlackBerry Push Service SDK be used for both options 1. & 2. mentioned above? (referring to public and business mode)

    II. is there documentation how to push Service SDK can be configured for the mode of the company?

    III. when you use BES Push is also limited to 8 KB content size?

    IV. is it possible to only a single client application that can be used to BES and BIS push?

    Thanks in advance.

    I. the SDK can be used to push either a BIS or BES. The SDK has a setting to determine if its pressure through the (public) BIS or BES (company). The SDK can be used to push push Essentials or Plush Push. The SDK software uses the API of PAP.

    II. I'm not sure of the documentation, but I don't know that the SDK can ask a BES for sure. But in the end, you need to set the flag to push public were false.

    III. no the BES is not a limitation of 8 k.

    IV. I'm not an expert on client applications, but I think you need to develop a version for BIS and a version for BES.

  • Problem with Sqlite when inserting huge data

    Hello world

    I am developing an app playbook, that need to store a lot of data, iam using the sqlite database,

    When iam trying to insert the data, it stopped insertion 263 every time, one did not get any exception or an error, can someone tell what is the problm

    Please someone answer me as soon as possible.

    Thank you.

    Try this

    protected  function getSqlConnection():SQLConnection{
    if (sqlConnection)
    return sqlConnection;
    var database:File =  File.documentsDirectory.resolvePath("xyz.db"));
    sqlConnection = new SQLConnection;
    sqlConnection.openAsync(database); //if you haven't already
    return sqlConnection;
    private function addManyEntries():void {
    var sqlStatement:SQLStatement = new SQLStatement();
    var sql: String = "INSERT INTO abc(name, number) VALUES (@name, @number);";
    sqlStatement.text = sql;
    try {
    for (var i:uint = 0, j:int = 500; i < j; i++){
                            sqlStatement.parameters["@name"] = "Medicine " + i;
                            sqlStatement.parameters["@number"] = ""+Math.random()*99999;    //if it's a string
    } catch (e:SQLError) {
  • How to work Blackberry Java or Webworks with PHP?

    Hi I'm new in the development of a Blackberry Application.

    I would like to ask?

    How can I pass a value of PHP for blackberry app?


    When (Blackberry application) click a button and it will automatically receive a (field) in the value of PHP / Web site.

    If the site passes a value as (name: Harry) and then the area of the blackberry application will appear 'Harry' in the text box. Thank you

    And also we must I use Blackberry Webworks or Blackberry Java? I can so able to create logic from above. Thank you so much support forums blackberry developers

    From: Kiheyt

    In order to obtain data from a web service (PHP or any other language), you must first create a connection to your server.

    The connection and the transferred data are generally independent of the server (especially when it comes to HTTP) as the connection is based on known standards and data is transferred in the form of bytes (which are numbers o that it doesn't really matter what language you are coding).

    In Blackberry you can create a connection to the server to retrieve data or connect 'push', in this case, your client is still connected and the server sends notifications to the client.

    To learn more about the first option, just look at 'http connection' in the forum (there are about 1000 different threads).

    For more information on the second option, search for "push" or "push notifications" and have a look here:

    As for the second question, I don't have enough information to help you. Maybe if you would give details on your request, we will help you even more.

    I hope this helps,


  • Inserting a new record in the database using a form empty ADF


    I'm trying to insert a new record into the database using a form.

    I have an Employee table and its corresponding entity object and the view object. The table has an id that is used as the primary key and is filled using a sequence in the comic book.

    Data controls, I dragged and dropped at the sight of the employee as a form of ADF and checked the submit button include. Then I dragged and dropped the validation on submit button operation.

    When I connect to the app and go to the page used to create, I have 2 problems:
    1 - the form is filled with the logged in user info.
    2. If I try to change the news and validation, the user info is changed in the database and no new record is created.

    It makes a little sense to me, but I would like to know if there is a way around it (get an empty form and insert a new record).
    NB: the employee id is not part of the form, I want to be filled using the sequence.

    Kind regards

    User, please tell us your jdev version!

    To do this, you must create a new record before going to the display of the form page. In a stubborn workflow (btf), you drag the operation createInsert of the VO on the btf and it will generate a link method, add a view to the btf and put a navigation of the binding of the method of the page. Mark the method as 'Activity by default'. Now, ren, you call the workflow, you create a new record that will show your blank form.


  • Error when inserting XML Date in the Table

    Hi all

    I am working on Oracle 11 g and trying to insert a date XML in the table but get error - below

    Query - insert into TableName (ID, CREATION, CREATEDBY) VALUES (50, *'2010 - 12-15 T 12: 57:19'*, 'Name')

    Error - java.sql.SQLDataException: ORA-01861: literal does not match the format string

    CREATED column datatype is Date

    When I try to use sysdate instead of hard-coding XML date of obtaining inserted successfully into the table. Please let me know how to pass this XML format date.

    Thanks in advance.


    I don't see any XML in what you posted. In any case:

    "2010 12-15 T 12: 57:19'.

    is a string, not a date. Use:


    For example:

    SQL> create table tbl(created date);
    Table created.
    SQL> insert into tbl values('2010-12-15T12:57:19');
    insert into tbl values('2010-12-15T12:57:19')
    ERROR at line 1:
    ORA-01861: literal does not match format string
    SQL> insert into tbl values(to_date('2010-12-15T12:57:19','YYYY-MM-DD"T"HH24:MI:SS'))
      2  /
    1 row created.


  • insertion error - date format picture ends before the conversion while

    My system: I use of Oracle Database 10 g Express Edition Release - product with SQL * more: Release and the first thing I've done in this project is a user account configuration especially for her through Application Express with all permissions and then connected with SQL * more and seized command and run scripts on it since.

    I got the following error was in a previous project, but I don't have the result of it so I don't know how much he touched me. We can not always distribute perfect projects so I could live with that. It is that this new project is the first that start from a previous one have of course, I still have the error so I think they'll be less forgiving of mistakes that I had more time to work on it. However, after hours of research & debugging tests I still cannot do things.

    I read on sites in development more than a couple that we should not rely simply on inputs of channel inserts on dates where there is incompatibilities with nls_date_format and based instead on TO_DATE. This seems logical and I have no problem of implementation, but there is a problem running it. :|

    The following is an excerpt from my project bringing the error that I need to move.
    Thank you so much for your help


    ALTER SESSION SET nls_date_format = "DD/MM/YYYY";


    -NoEmp, name, NoFonction, DateEmbauche, NoDept, salary
    INSERT INTO VALUES EMP (1230, "DAHER", "ERIC", 1, TO_DATE (DECEMBER 17, 1997 ',' DD/MM/YYYY ""), 40, 20000);
    INSERT INTO VALUES EMP (3235, "LEMAY", "PATRICK", 3, TO_DATE (FEBRUARY 20, 1982 ',' DD/MM/YYYY '), 20, 3500);


    Modified session.

    Table created.

    INSERT INTO VALUES EMP (1230, "DAHER", "ERIC", 1, TO_DATE (DECEMBER 17, 1997 ',' DD/MM/A))
    YY'), 40, 20000)
    ERROR on line 1:
    ORA-01830: date format picture ends before converting all of the input string

    M/YYY'), 20, 3500)
    ERROR on line 1:
    ORA-01830: date format picture ends before converting all of the input string


    The Xgc of channel for the IRC server freenode user [#sql | irc://freenode/%23sql] had me I was using 3 characters for my picture/mask/filter /... instead of the 4 that taking data. then they became "JJ/M".
    M/YYYY "."

    How small error but with such devastating consequences.

    Published by: user13420426 on December 6, 2010 01:39

    You're 1 shy O.

    TUBBY_TUBBZ?select TO_DATE('17/12/1997', 'DD/MM/YYY') from dual;
    select TO_DATE('17/12/1997', 'DD/MM/YYY') from dual
    ERROR at line 1:
    ORA-01830: date format picture ends before converting entire input string
    TUBBY_TUBBZ?select TO_DATE('17/12/1997', 'DD/MM/YYYY') from dual;
    17-DEC-1997 12 00:00
    1 row selected.

    Notice how I YYYY where you YYY.

  • ADF progress indicator to insert the data into the file table.

    I have a requirement where the progress bar should indicate the percentage of completion to insert the data into the tables of database files in a given folder path. I found an article that explains how to get the progress indicator when downloading a file in I believe that I must first get the total number of files in the folder and then begin to compare with the number of files that are inserted into the table similar to what is done by downloading (getting the file size and download size), but I don't know how to do this. Can anyone help?

    May be that this example allows you to

    * 042.     Dynamically change the color of progress bar based on its current value *.

  • Insert the date in a xslt mapping table


    I have develop a BPEL process and I'm trying to insert the date system through BPEL in oracle table. I wrote what follows in the part of xsl to transform my file:

    < xsl: Value-Select = "orcl:query - database (& quot; Select to_date (to_char(sysdate,'YYYY-MM-DD') | to_char (sysdate, 'hh24:mm:ss'),' YYYY-MM-name of the DDHH24:MI:SS of quot; () true, true (), & quot;jdbc:oracle:thin:sample_db/[email protected]:80:XE & quot; dual) "/ >"

    But the data are not implemented, I don't know what is the error. All answers are appreciated.

    Thank you for your time and attention,

    You are missing the T and he also like to use aliases for some reason any. Also is this port right, it shouldn't be 1521?

    It is best to do this in the wizard as he places the escape to "(") character in the right place. "

    Take a look at this post

    You also have the option of the xp20:current-dateTime() of expression

    see you soon

Maybe you are looking for