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.io.URI; 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 | LabelField.USE_ALL_WIDTH); setTitle(title); add(new RichTextField("Attempting to insert data into " + "MyTestDatabase.db on the SDCard.")); try { URI myURI = URI.create("file:///Store/Databases/SQLite_Guide/" + "MyTestDatabase2.db"); d = DatabaseFactory.open(myURI); Statement st = d.createStatement("INSERT INTO People(Name,Age) " + "VALUES ('John',37)"); st.prepare(); st.execute(); st.close(); d.close(); add(new RichTextField("inserting data successful")); System.out.println( "inserting data successful" ); } catch ( Exception e ) { System.out.println( e.getMessage() ); e.printStackTrace(); } } }
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
AlfieNevermind, 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 advanceConvert 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:
- 'database is locked'
- "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:
- Open a database connection
- Perform the insert in a while loop for JSON objects
- Use a loop through the JSON array and passing nested in the database, a connection
- Leave the nested loop
- Exit the loop
- Close the database connection a finally statement.
I don't:
- Open a database connection
- Perform the Insert
- 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.
Almost...
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: http://docs.blackberry.com/en/developers/deliverables/8682/CS_creating_a_parameterized_SQLite_insert...
-
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 parameterthe 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 >
< BODY BGCOLOR = "#FFFFFF" >
< 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 treatmentCan someone help me to insert CLOB data in my table HtmlPage above
Thank yousoftware:
Form [32 bit] Version 9.0.2.9.0 (Production), oracle JInitiator: Version
1.3.1.9, WebUtil Version 1.0.2 (Beta), window xp service pack 2 build 2600, Internet Explorer 8
LOOP
UTL_HTTP. READ_LINE (RESP, File_Metar, TRUE);
p2_putlines (File_Metar);
USING_CLOB. ADD_MORE (1, File_Metar);
USING_CLOB. LOB_INS (1, 'Metar_taf', File_Metar);
END LOOP;
UTL_HTTP. END_RESPONSE (resp);You should not use USING_CLOB. LOB_INS (1, 'Metar_taf', File_Metar) inside the Loop.You must use
LOOP
UTL_HTTP. READ_LINE (RESP, File_Metar, TRUE);
p2_putlines (File_Metar);
USING_CLOB. ADD_MORE (1, File_Metar);
END LOOP;
-
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:
- Push for the BlackBerry Enterprise Server software
- BlackBerry Push service
- Push blackBerry SDK service
What I discovered thanks to these documents.
- There are two formats that can be used to send data through the BES (PAP push / push RIM)
- BlackBerry Push service has two levels (BB push Essentials / BB push more - limited to 8 KB content)
- 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 PushSDK.properties 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{ try { 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 { sqlConnection.begin(); 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 sqlStatement.execute(); sqlStatement.clearParameters(); } sqlConnection.commit(); } catch (e:SQLError) { trace(e); sqlConnection.rollback(); } }
-
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?
Example:
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,
E.
-
Inserting a new record in the database using a form empty ADF
Hello
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
MBUser, 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.
Timo
-
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.
Concerning
NikhilI 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:
to_date('2010-12-15T12:57:19','YYYY-mm-dd"T"HH24:mi:SS')
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. SQL>
SY.
-
insertion error - date format picture ends before the conversion while
My system: I use of Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product with SQL * more: Release 10.2.0.1.0 and the first thing I've done in this project is a user account configuration especially for her through Application Express 2.1.0.00.39 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
DynV
H2.
code
ALTER SESSION SET nls_date_format = "DD/MM/YYYY";
DROP TABLE EMP;
CREATE TABLE EMP
(
NOEMP INTEGER NOT NULL PRIMARY KEY,
NAME VARCHAR (15) NOT NULL,
FIRST NAME VARCHAR (15) NOT NULL,
NOFONCTION INTEGER NOT NULL,
DATEEMBAUCHE DATE,
SALARY INTEGER NOT NULL,
NODEPT INTEGER NOT NULL-,
-FUNCTION REFERENCES FOREIGN KEY (NOFONCTION),
-FOREIGN KEY (NODEPT) REFERENCES DEPT
);
-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);
H2.
result
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
INSERT INTO VALUES EMP (3235, "LEMAY", "PATRICK", 3, TO_DATE (FEBRUARY 20, 1982 ',' DD/M))
M/YYY'), 20, 3500)
*
ERROR on line 1:
ORA-01830: date format picture ends before converting all of the input string
H1.
solution
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:39You'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; TO_DATE('17/12/1997' -------------------- 17-DEC-1997 12 00:00 1 row selected. TUBBY_TUBBZ?
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
http://www.gebs.ro/blog/Oracle/Oracle-ADF-progress-indicator-in-Fusion-Middleware-11g/. 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 *.
http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/index-101235.html
-
Insert the date in a xslt mapping table
Hello
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,
ChavignyYou 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
http://forums.Oracle.com/forums/thread.jspa?threadID=892971&TSTART=25
You also have the option of the xp20:current-dateTime() of expression
see you soon
James
Maybe you are looking for
-
I am running version 32. I was invited by what seemed to be the usual way, that there is an important security update. For some reason, I felt uneasy and decided to go to Firefox directly where it says "Congratulations, you are running the latest ver
-
Removal of pictures movies does not release a storage capacity
I picked a bunch of movies by right-clicking and clicking on the Remove feature. The sound effect of the garbage is played, but no memory are released. It does not appear in the Recycle Bin can be. I tried to restart as well. How can I remove th
-
Get a new recovery CD (English)
I bought my computer laptop satellite m40x in Germany. Its windows was originally in German. I return to India now and want a recovery for Windows English CD. It's a way I can get it?
-
Workstation CPU temperatures...
Is there anywhere that I can read on standard desktop CPU Temperatures? I have a xeon Z600 of x 5650 and 60/70 ° c Idle and 80 c + loads of experience. These temperatures seem high compared with a CPU of office time... jobs just run more hot than the
-
Never had a problem up to and including this morning. All of a sudden, I'm not receiving emails about my "BOLD". Went to Blackberry link http://bis.na.blackberry.com/html?brand=mycingular and even deleted and added my email on my device addresses. Re