SQLite by WebWorks?

I want to create a SQLite database for local storage on the PlayBook. However the database appears as undefined.

Is it possible to do so and if so, how.

var db = window.openDatabase ("Database", "1.0", "Database", 200000);

function initializeDB()
{
 
DB.transaction (function (tx)

{
tx.executeSql ("TABLE IF NOT EXISTS CREATE table (Id INTEGER, name) ');
tx.executeSql ("INSERT INTO ListName (Id, Name) VALUES (1,"default")" ");
});
 
DB.transaction (function (tx) {}
tx.executeSql ("SELECT * FROM table', [], {}, function (tx, results)")
var len = results.rows.length, i;

for (i = 0; i< len;="">
$('#div').append (')

  • Find the lines: "+ results.rows.item (i). Name + '
  • ');
    }
    (}, null);
    });

    }

    It works in Chrome but not in FireFox or on the PlayBook.

    This gives a shot and see what happens

    try
       {
          var dbSize = 1 * 1024 * 1024;
          db = openDatabase("Mydb", "1.0", "Mydb", dbSize);
       }
       catch ( Error )
       {
          alert ( Error );
       }
    

    Tags: BlackBerry Developers

    Similar Questions

    • How to set up/use sqlite to webworks?

      Hello...

      I am new to the webworks and is there anyone able to help how to install sqlite db using webworks? is there any installer download for eclipse and device?

      Many... Thanks guys...

      Hi Tim,.

      Finally I found the problem, I need to activate the Simulator from SD card to store files.

      It was NOT the option.

      After that I put this, the sample Weather app run perfectly.

      A big thank you...

      Rudy

    • Read a file external .sqlite in WebWorks

      Hello!

      I am developing an app for BB10; I have a .sqlite file that is generated by a software and I want to do some queries about it.

      I read that I can't rely on the HTML5 database because it only allows you to use an arbitrary .sqlite file, but only on those integrated in webworks.  Is this correct?

      Is it possible to read data from my WebWorks .sqlite file?

      Yes, this is not a restriction of WebWorks so as a restriction of security itself imposed by browser based environment. The Web mode, you cannot load a sqlite arbritray. Or at least as far as I know.

      The simplest method is, perhaps, do the following:

      1. gather or load database as a drop of the database of SQL commands.

      2 loop on the loaded file and run commands on the database WebSQLite insertion and the creation of all the tables you need to load/runtime.

      3 queries you would like your information.

    • 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

    • Create or open the sqlite db in webworks for playbook

      I have a sqlite database. I want to open the db using javascript. Also I have to keep the db locally and wrap it up. Can someone let me know with a sample code how to do CRUD features in sqlite db using JS. Please answer soon, if anyone has an idea.

      Yes its working! I he repackaged his work in the Simulator. Thankz

    • Accessing an application WebWorks built the database via a Java application

      Hi all

      My Java application needs to access a database that was created by a WebWorks built application. I see WebWorks encryption applications their databases using the code keys automatically signing. When I first tried to read the database, he said that it was encrypted as IOException: headers are encrypted. Since then, I installed the same key code in my Eclipse IDE to signature and have signed the java application with the same keys used by the WebWorks app. I always seem to get an IOException error, but this time it does not specify the exact error.

      Quite simply, I need to use the same database created in the WebWorks app in my Java application. Is it possible if I use the same code key for both signature requests? Or WebWorks uses a completely different algorithm to encrypt data in the database from Eclipse and so cannot use the same database?

      Thank you for all your help.

      Rob

      Yes, the DB is encrypted by default by using the identity of the application (code signing key and I believe in association with the name of the application)

      Thus, the type of DB of SQLite that is created from a WebWorks app is different from one created from a Java application, which can be a conflict at stake here.

      If you believe that it is a Google Gears database!

      https://github.com/BlackBerry/WebWorks/BLOB/master/framework/src/js/html5_init.js#L586

      Well Yes, to subsidize bequests to devices BBOS 5.0, which had no WebKit as web rendering engine, Gears is the 'wedge' up here.

      For the above reasons, I do not think that its going to be possible for you to achieve what you're trying with SQLite DB. To share data between applications on BBOS, you would need to use a different channel (encrypt the data and save it in the file system, or use your own remote web service + DB)

    • WebWorks IndexedDB encryption?

      Hello there are other developers!

      I think I read somewhere that sqlite in the Webworks Applications databases are encrypted.

      What I was asking is if goes the same for IndexedDB databases used in the Webworks Applications since I think in browsers, indexedDB has only the same security cookies (same access domain only). If they are not encrypted are there ways encrypt or add any additional security for them?

      No, it is not encrypted.

      However, due to the nature of the BlackBerry 10, it is secured by the operating system in the sandbox of the application (i.e. the OS restricts all other apps trying to access).

    • Integration of database with WebWorks?

      Hello developers,

      I develop an application for someone for blackberry 10 WebWorks, and there is no need of a relational database. Is it still possible for WebWorks?

      Thank you!

      In addition, HTML5 supports WebDB which uses a sqlite implementation that is integrated into the browser. I know that you can not use the foreign keys on Chrome (due to certain parameters of lame sqlite pre-configured on part of Chrome), but I don't know if the bb10 browser allows them.

    • SQLite query processing:-defined SQL error:-it works very well in BB OS6.0 bt not in OS5.0 BB

      Hello

      I'm a newbee in webworks...

      I am trying to use SQlite. I create a table and access the data from it on the same page... it works fine... but when I try to do the same thing in different page it gives the error of SQL batch. Now even once when I click the button to access from this page it works fine.

      I mean that the SQL query does not work in the first time. the second time it works.

      It works great in BB OS6.0 bt not in OS5.0 BB

      What a timing problem in 5.0 or something else...?

      Please let me know the problem. I'm stuck... Help, please!

      Thank you, Joy Gupta

      Hi joygupta,

      It is important to realize that all SQL database api is written to be used asynchronously. This means in general in order to ensure that your code works you must perform your events one after the other. If you look around these forums there are plenty of examples of people making small errors that have been fixed in this way.

      If you need help I'd post your code.

    • BlackBerry WebWorks - Eclipse

      Hello

      Here, I get a little confused.

      Here's my problem:

      I have a BlackBerry WebWorks working on Eclipse environment (2.5.1 * BlackBerry WebWorks plugin) and BlackBerry WebWorks plugin SDK (2.0.0), okay?

      So, the thing is: I get a "ClassNotFoundException" error in my application. I have two .jar in the "ext" directory One is my custom package called Database.jar (where I make Access db with sqlite and so on (it is a plugin phonegap)) and the phonegap.0.9.4.jar which is the framework.

      It is very good. Everything works like a charm when I compile with bbwp.exe version 1.5. But when I compile with the 2.0 SDK, I get a ClassNotFoundException. I'm looking for the class that is not found. That's fine also.

      I would like to know one thing: how is possible to debug java code in this environment? I have no IDEA how must! I do the java code by my spirit! It's crazy!

      Hello again everybody (who have read this thread).

      The thing is: I already knew the answers... but this error was driving me crazy.
      The problem of the "ClassNotFoundException" was: I extracted my Database.jar.
      Just that! Since the 1.5 SDK, it was inside the pot and now I've pulled the jar into the "ext" folder and everything works like a charm...
      Strange.

      That's all. It is the answer for my son. Thanks again.

      PS: The question on ' how to debug java code in Eclipse WebWorks still... ". ». If someone can answer me...

    • SQLite - no need to close?

      I don't see a reference to any methods close to the database, transactions, etc. resultset in Webworks for SQLite documentation. I want to assure you that I am using device resources as efficiently as possible and I just want to confirm that there is no need to close or cleaning for SQLite.

      No need to close. No API to perform a closure either, which makes it easy :-)

      In all honesty I don't know exactly how we can get away with it, I'm assuming that the platform does the cleaning for us because it will or on request nearby. I had no problems as a result of no close API however. You are also free to reuse any transaction, db, variable etc for other uses at any time without having to release them to the top in no way first.

      Erik Oros

      BlackBerry Development Advisor

    • SQLLite on Webwork application resp.

      Hi guys

      Well I've been playing webworks, I have a webworks app application using SQLLite to access a massive load of data from the database. I went to sqllite because I wanted this data to be stored locally within the fon one can access it without needing my fon have internet or waiting to load the page.

      But my problem is due to the fact that my database has a large amount of data and I don't no that so that it can be created from screatch in my code. Since I am doing already hv the database sqllite file, how do I apply to always read the path no matter what I specify when reading from the database. I want to deploy my application with the database without, so I want the database to be located in the my applications webworks directory and still read it from there. How to apply to read database file which I kept without the application directory.

      Kind regards

      (newbie webworks)

      I don't know if WebWorks natively supports database "external." In other words, even if precompile you the database SQLite and package it as a resource, I think not that there are methods to access.

      You could probably write an extension to do this, but it would be a major effort.

    • How to dynamically access the SQLite result set?

      I want to dynamically access the SQLite result set. Since webworks does not support the "PRAGMA table_info (table_name); I save all newly created information tables in a single two-column table called schema. schema has two columns, table_name, and column_name.

      So I created a function to dynamically access the data in the table. I use the item = results.rows.item (i) and that the data access with item.column line.

      column is a variable that will receive the value of a schema representative of column_name. When I alert (column) I get the column_name is correct, but when I used item.column my results are "not defined".

      any advice on how to solve this issue.

      I managed to solve this issue. The solution is the following: the normal way to access the data of the variable item = results.rows.item (i) is item.column (where the column is the name of the column in the database table. To access the data dynamically, I Specifies a var col1 to assign different values in col1. I then access the data in the database using point [col1] hope that makes sense. If you need a further explanation contact me at [email protected]

    • On a 9870, where is the SQLite db file?

      I would like to manually remove the SQLite db file my request of Webworks has created on a device to 9870 (6.0.0.666). Problem is that I can't. I have CAD on a 9900 without problem.

      I don't know where the database is created and stored. Someone at - it suggestions? Is it possible to explicitly define where it is stored?

      Thank you!

      > Is it possible to explicitly define where it is stored?

      No, this is handled by the underlying platform of the Web.

      Search in the following location:

      \\BlackBerry\system\appdata\rim\

      You have a SD card on your 9870 / 9900? If so, it may have been recorded here.

    • SQLite DB encryption

      I had like to know the details of encryption of a database created via webworks app. So far I've been able to learn from the separate comments in the forum just SQLite DB in Web app works is encrypted by default. I tried to open the database and I don't see that it is encrypted.

      Some of the links that point out:

      http://supportforums.BlackBerry.com/T5/Web-and-WebWorks-development/database-problem-in-the-WebWorks...

      http://StackOverflow.com/questions/9738163/BlackBerry-attach-pre-populated-SQLite-database

      http://supportforums.BlackBerry.com/T5/Web-and-WebWorks-development/reading-SQLite-database-created-...

      http://supportforums.BlackBerry.com/T5/Web-and-WebWorks-development/can-a-BlackBerry-SQLite-database...

      http://supportforums.BlackBerry.com/T5/Web-and-WebWorks-development/questions-on-JavaScript-extensio...

      I like to know are the details. Is there a well documented feature spec or the link that we can lead our customers to?

      Okay, I checked with some people and I more information now on what is the situation.

      On BBOS:

      [JAVA] In a Java application-SQLite databases are not encrypted by default, but can be encrypted.

      [WebWorks] In a WebWorks app SQLite databases are encrypted by default and there is no API to change or do anything with the encryption.

      The PlayBook/BB10:

      [WebWorks] Databases are not encrypted by default - as they exist within secure application sandbox.

      In the case of BBOS WebWorks encryption is via WebWorks - who called the BlackBerry Java SQLite API to do this. If these docs that I sent on SQLite encryption in Java apply to the WebWorks.

    Maybe you are looking for