Deleting line of SQLite database: Blackberry

I m using the table adapter screen to create a layout that display data from database in tabular way. I added a button field for each layout line to remove that particular line. Below I m attaching the code for deletion. He demonstrated exceptional: SQL logic error or missing database. Is there something wrong with my request? There is no problem in database creation functions, tables, insert, dérirez etc.. Kindly help me out here. It gives an error to. prepare(); statement.

I m passing the name of the query, that is obtained from the selected line

public void deletetarget(String cname) {

        Statement deletetarget = null;

        try

        {
            URI myURI = URI.create("file:///store/home/Databases/SampleDatabase.db");

            d.close();
            d = DatabaseFactory.open(myURI);

    deletetarget = d.createStatement("DELETE  FROM targetCity WHERE KEY_CITYNAME         ='"+cname+"'");

            deletetarget.prepare();

                deletetarget.execute();
            deletetarget.close();
            d.close();
        }

        catch ( Exception e ) 

        {         

            System.out.println("Delete Statement Exception "+e);
            e.printStackTrace();
        }
    }

There is nothing wrong in the query... some sort it has been resolved by... writing method database.close () on the top of the URI field

Tags: BlackBerry Developers

Similar Questions

  • Encryption and Protection of SQLite database - App of signature with the Signature of Blackberry tool

    Hello

    I am trying to encrypt and protect my SQLite database. To do this, I have generated a pair of public/private key using the administration Blackberry signature tool. Then, I added the .key file to my project and written the code for encryption and data protection. Then, I signed the app with Blackberry signing authority tool such as mentioned in the documentation. It was duly signed. But my application does not work on the device. It shows that my application tries to access a secure API which means that it is not properly signed.

    What could be the problem?

    And also I want to know what is the difference between the signing of the "Tool of signed" app within the eclipse and sign the application with "Blackberry signing authority tool '?

    I sign my application with eclipse itself "tool of signed" before adding the public .key file and it worked very well.

    Please suggest.

    Thank you.

    You must sign with both.

  • Attach a SQLite database to another


    The command to ATTACH a DATABASE is not supported by the implementation of SQLite on BlackBerry Smartphones.

  • Disappeared on update SQLite database

    Hi all

    I just submitted an update of my application that uses a SQLite database.  In the update, I changed the table creation code and removed one of the columns of the table.  Nothing else has been changed with the code base.  And I still have the clause "if not exists" in the create table sql statement.  BB has approved my application and I downloaded the version on my PB noticed two horrible things.

    First of all, I have now two icons on my homescreen with the same name.

    Secondly, when I start the new version, nothing in my database.  It seems to create a new as if the other did not exist.  I went back to my source code and I tried to create two tables with the same name and reinsert the old column that I had deleted, but as I had suspected, the program threw a "table already exists error" when I tried to run the second create statement.

    Have I missed something obvious with SQLite databases?

    Also, I changed the minimum required version of Tablet OS to 1.0.6 requirement of 1.0 for my application.  Would this have something to do with the duplication?

    When you test this point until I published, there was no duplication and my SQLite data are not allowed.  I since temporarily withdrew my application of the sale.

    Thank you very much all the advice.

    As John said, you have changed your application somehow signature, so that it shows up as a brand new application.  It is usually because you asked new signature keys, but it can also occur if you have changed the package of your application, or possibly other ways id.

    Moreover, there is no way to actually remove a column in SQLite, so what you try to do it very probably won't work anyway.

    The table creation code is executed only once.  After that, the table exists and you can't run again. There are some statements like 'ALTER TABLE ADD COLUMN xxx foo' that could add a column, with some restrictions, but there is no equivalent 'DELETE a COLUMN '.  The only way to do that is to create a temporary table with the missing column, copy the data from the old to the new table, DELETE the old table, then rename the temporary to the old name.

    Often, you may be better to do something as affecting only the old NULL column (if you have authorized that) or just ignore him.

    In the future, always test thoroughly using the version signed by your application, just prior to submission.  Make sure you have the previous signed version installed first, so that you can simulate the "update" to the new, but also test with no previous version installed.  You should be able to observe the same behavior that users see by doing this.

  • Ugh... Requirement: A TimerTask making an HTTP call, parsing JSON, insertion into a SQLite database.

    How to implement a better design of the following?

    I have a UiApplication which has the following requirements:

    1. A static timer in the class that extends UiApplication.
    2. A class that extends screen and contains a class internal which extends TimerTask.
    3. When a user accesses to the screen, the TimerTask is started with:
      _timer.schedule(MyTimerTask, 1000, 15000);
      
    4. The first step is to do an HTTP call and return a valid JSON object which varies in structure - that is, it has a wide variety of paintings and JSON objects.
    5. The second step is to analyze and insert the JSON object values into tables in a SQLite database. The SQLite file is on the map.
    6. The third step is to read the updated SQLite table, loop through the table and build my ObjectListFields with the new values, and attach them to a VerticalFieldManager.
    7. The fourth step is to replace the old VerticalFieldManager with the new VerticalFieldManager and push the screen pop and updated then the current screen - so I have a stack of view high one single layer.

    Now the logic is actually on the spot, but since the TimerTask must cover every 15 seconds, I am a memory leak in all directions.

    To try to solve this problem, I have:

    • Cancelled the TimerTask with the onObscured and the onUiEngineAttached (false).
    • Restart the TimerTask with onExposed and onUiEngineAttached (true).
    • My DatabaseConnection closed the finally statement.

    However, when I look at the objects in Eclipse BlackBerry objects View when the TimerTask is not running, I still see 1 ~ 4 TimerTask objects and 1 ~ 4 DatabaseConnection objects.

    TimerTask both DatabaseConnection have a static instance (I don't have several entry points) with the following in my class that extends UiApplication:

    public static Timer _timer = new Timer();
    public static Database db = null;
    

    I attribute db when I need it with a call to DatabaseFactory.open within the class that extends TimerTask.

    Now that the business logic is correct, how to improve the design so I don't not leaking memory in every way?

    The statement closed the database is being called in, because I can set a breakpoint and see it has reached.

    Instead of onObscured/etc, you can move them into onVisibilityChange (boolean) is only in one place. Cancel your existing TimerTask before running a new, or at least check the TimerTask reference if you are only creating a... not just passing 'New TimerTask' in the calendar method without being able to track this object reference.

  • How to run SQLite on Blackberry JDE 5.0... ? Simulator of

    Hai,

    How to run SQLite on Blackberry JDE 5.0... ?

    Is it really need all jde settings? for sqlite running applications?

    I use the source-

    class InnerClassScreen extends form {}
         
    sqliteDB public database;
    public InnerClassScreen() {}
                
    LabelField title = new LabelField ("Create DB application",
    LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
    setTitle (title);
    Add (new RichTextField ("initialize db create process..."));
                
    try {}
    URI uri = URI.create)
    "file:///SDCard/Databases/database1.db");
    sqliteDB = DatabaseFactory.create (uri);
    Add (new RichTextField)
    (("Status: database was created successfully."));
    } catch (Exception e) {}
    System.out.println (e.getMessage ());
    Add (new RichTextField)
    (("Status: database has not been created."));
    Add (new RichTextField (e.getMessage ()));
    e.printStackTrace ();
    }
    }
    }

    Unfortunately had the exception-

    net.rim.device.api.database.DatabasePathException: invalid path name. Path does not contains a list of appropriate root. See class FileSystemRegistry for more details.

    Hello
    In your eclipse go to debug configurations in select tab Simulator, in memory of Simulator tab selection in this last use system files from the pc to SDCard policy file box to check this and give some trail (IE any path of the folder) this directory is worked as a SD card in your Simulator...

    Thank you...

  • "SQLite database is supported only on SD card or storage similar." - I need real documentation on this.

    I read the following quote "SQLite database is supported only on SD card or similar storage." on this forum.

    I need real proof to send to my product manager.

    Are there available documents or where in the API is that has turned out?

    Documentation (http://docs.blackberry.com/en/developers/deliverables/8682/SQLite_file_locations_719036_11.jsp)

  • How to remove a line in the database

    Hello

    I want to remove a line in the database... I used the (drag and drop the data control), delete operation when I push the button in the page it removes just in the session not on the database,

    This means that when I reload the session or I check line in the database, that I always find...

    I use jdeveloper 12.1.3.0.0 and business components.

    You must press the validate after the delete operation (from data controls drag / move validation operation).

    If you want to run Remove and validate the operation in a single action, in your page, you can add the button and in the action of the button write this code:

      public String DeleteAction()
      {
        OperationBinding operationBinding = BindingContext.getCurrent().getCurrentBindingsEntry().getOperationBinding("Delete");
        operationBinding.execute();
    
        operationBinding = BindingContext.getCurrent().getCurrentBindingsEntry().getOperationBinding("Commit");
        operationBinding.execute();
    
        return null;
      }
    

    Make sure that the "Delete" operation point to the desired pageDef VO. and don't forget that "Commit" operation existence in pageDef.

  • How to find the SQLite database browser on an imac

    Where is the SQLite database browser on an iMac?

    Here, you can get a http://sqlitebrowser.org/

  • Test a SQLite database conversion: Please advise

    Hello

    In my application, I use a SQLite database to store data. I'm about to release a new version that contains several additions and modifications to the database. I obviously need to test the conversion, but have no idea how simulate this. I have two projects in FlashBuilder, one contains the old version, the other new version. The project names must be different and thus the name of the - app.xml, but the content is the same except for the version number. The is also the same. I expect that would do the trick to access the former base of the old project to the new project, but it seems not to happen.

    Any ideas or suggestions are highly appreciated.

    I found the following to test my update: first copy and paste the code of the old version of the app in the current .AS file and run it. Then add some data (for example via the Simulator), then copy and paste the code from the new version of the app in the current .AS file and run it. Space-saving, but it works.

  • How to add a sqlite database to package for playbook

    I use FlashBuilder Burrito and you have created an application that retrieves data from an sqlite database file. It works fine on my computer, but in the Simulator, it does not find the database. I think that I tried to add the file anywhere in the package, but it never works on the playbook. If I create the database in the code, it works fine, but I need to package the database programmatically.  Can someone point me in the right direction?  Thank you

    This database is read-only?  Never need to change?  If this isn't the case, you'll want to copy it in the folder appstorage as shown in this other thread.

    In any case, you seem to have lot able to find the database file. Here's what I would do in your place.

    Take your .bar file and extract it or dig in there.  It's just a .zip with a different extension file, so I assume that you know how to do it.

    Inside, there are files in the file meta-inf / folder (at the less OBVIOUS. MF that is interesting to look at) and air / folder.  All application files (.swf, assets, etc.) are air / folder.

    To do anything in this air / folder, use File.applicationDirectory.  Which means that if, for example, your database is in air/foobar/mydata.db in the .bar file, you will get a path as follows:

    File.applicationDirectory.resolvePath('foobar/mydata.db').nativePath
    

    Who help me?

    You can see that the file is in a different location in the simulator that where you when you run in with ADLS (test on your development computer) and .bar.  If this is the case, you have several choices, one of which is to change the layout of a way to always appear in the same place, anywhere that you test.  Someone who uses actually an IDE would have to help you with that...

  • Is it possible to display the SQLite database?

    I can debug my app on my Playbook, but is it possible to display the SQLite database? I want to confirm it works.

    If you can recover on your PC/Mac, I use "Lita" SQLite DB management applications (its an AIR application).

  • When sqlite database will be located in the Simulator.

    Hi all

    I wanted to get the location of the sqlite database file, but don't really know where it is located.

    Here is my code to create a database.

     QSqlDatabase database = QSqlDatabase::addDatabase("QSQLITE");
     database.setDatabaseName("./data/customerDatabase.db");
    

    Any help would be appreciatied.

    Oh, I think that I understand your question now.

    The db file will be updated

    //data/customerDatabase.db

    The com.example.quotes.testDev_mple_quotes19e3de88 file will be little difference in your Simulator. You must use the System target file browser (Windows--> views show others-->--> QNX target--> target file system browser) to navigate to this folder.   You should find the folder with the name of the started by your package declared in your bar - descriptor.xml name.

  • view the contents of the sqlite database

    Hey

    Have created a sqlite database and entries stored in the database, I'm stuck all trying to display the contents of the database on the screen.

    I tried thi, but it does not work.

    Try
    {
    D database;
    Var myURI = URI.create ("file:///SDCard/Databases/SQLite_Guide/" +)
    "MyTestDatabase.db");
    d = DatabaseFactory.open (myURI, true);
    Statement st = d.createStatement ("SELECT * FROM data ;"); ")
    St.Prepare ();
    St.Execute ();
    St.Close ();
    d.Close ();
    }

    Can someone tell me please on how should I proceed?

    Thank you very much.

    Remove the rank r = c.getRow (); exposed outside the while loop and check.

    because, it is the 1st row in the result set is assigned to the r. If the query returns only one record, the while loop will not run.

    Before you ensure that the data are available in the table.

  • How to display a SQLITE database being created

    In my application Iam using the SQLITE database. I discovered the code how to create DB and create a disk etc. My question is:

    Is it possible to display dashboards created DB and its fields and records which is recorded in this table. I can't find any answer for this that I've seen to recover the data in the table by using queries and display in a listView, etc..

    Is it possible to display the SQlite DB tables and their fields and the saved recordings in their. Please help me out

    In Momentics choose View Navigator of the target file system. You can use 'copy to file system' to copy the database on your PC.
    On the PC, I use the Firefox "SQLite Manager" plugin to display and manipulate data. You can find it using the plugin manager.

Maybe you are looking for

  • Problem running Windows 7 Ultimate on Toshiba NB 500

    I have a Toshiba NB 500 brand new, bought with Windows7 Starter. I've upgraded to Windows 7 Ultimate and performance are terrible. The processor works 80-100% beyond 1 GB of RAM are used only by the system and all the programs I try to start takes fo

  • Some tips for the Windows Live Mail 2011 0x8E5048 fixing error code?

    Live Mail not keep open, indicating that my calendar is corrupted.  Above the error code

  • HP 655 G1: Touchpad problem

    I have a problem with a half year old HP 655 G1. When Windows has started the touchpad works but after a about a minute, the touchpad no longer works.  A regular mosue works without problem. When you restart the computer, the touchpad for about a min

  • Why can I play a WMV video that I created, but not import it into Windows Movie Maker?

    Why do I get the error message "the file * *.wmv cannot be imported because the codec required to play the file is not installed on your computer." If you have already tried to download and install the codec, close and restart Windows Movie Maker, an

  • I formatted my computer vista laptop dell

    and three of the four discs provided with the laptop when I bought it. they are as follows: 1. first I reinstalled a BLUE disk that said ASKING about it and it says to reinstall before you install the operating system... 2. then, I reinstalled the GR