net.rim.device.api.database.DatabaseIOException: File system error (12) - blackberry

I have created a tab bar which appears when I enter first time in database screen, this code is working fine. But when we go on another tab and again go on database screen tab it throws an exception
net.rim.device.api.database.DatabaseIOException: File system error (12)
I have closed database properly.

This error occurs when you try to open database which already open.
In first tab, you have opened database connection but when you switch another tab then how you close your database connection.
You should close database connection before reopen.
see following link for more details
http://docs.blackberry.com/en/developers/deliverables/29299/Opening_and_closing_databases_1585333_11.jsp
If you still not able to resolve your issue, please paste your database code.

To open database code
public void openDb(){
try{
closeDb();
// Open the database
URI uri = URI.create("Go2Reward.sqlite");
Logger.debug("-----URI-----"+uri);
_db = DatabaseFactory.open(uri);
}catch(Exception e){
Logger.error("--------- in open db====="+e.getMessage()+"----"+e);
}
}
// close database
public void closeDb(){
try{
if(_db != null)
{
Logger.debug("----close db---");
_db.close();
_db = null;
}
}catch(Exception e){
Logger.error(" ---------in close db" , e);
}
}
code to get data from database is as follow
public Vector getCategoryVector() {
Vector categoryVec = new Vector();
try{
openDb();
Statement statement = _db.createStatement("SELECT category FROM CategoriesTable");
statement.prepare();
Cursor cursor = statement.getCursor();
Row row;
while(cursor.next()) {
row = cursor.getRow();
categoryVec.addElement(row.getString(0));
}
cursor.close();
statement.close();
}catch (Exception e) {
Logger.error("---error getCategoryVector---"+e.getMessage());
}finally{
closeDb();
}
return categoryVec;
}
but when i open the database it work fine but within 10 transaction it returns the exception net.rim.device.api.database.DatabaseIOException: File system out of resources

Related

xamarin.forms application not running on ios simulator

I am working on Xamarin.Forms app and it's working perfectly fine on Android device. Anyway, when I am trying to run it on iPhone simulator it's just showing the main screen of the app, but none of the features are working.
The main screen consists of two parts of which one is to browse and open files and the other is to open a menu. The layout consists of Browse, process and exit buttons and when I click on the browse button to open file explorer an alert is displayed, that something went wrong.
I enabled breakpoints and tried debugging it, but the control is going to catch exception part directly.
Here is the code for it can anyone please help me with this part? I am using Xamarin.Plugin.Filepicker NuGet package. When I place the cursor on the Exception I can see that
System.NotImplemented Exception:This functionality is not implemented in the portable version of this assembly,you should reference the NuGet Package from your main application project in order to reference the platform specific
and the code is
private Plugin.FilePicker.Abstractions.FileData file =
default(Plugin.FilePicker.Abstractions.FileData);
public async void OnBrowse(object o, EventArgs args)
{
try
{
// var file_path =
this.file = await CrossFilePicker.Current.PickFile();
if (this.file == null)
{
return;
}
string extensionType = this.file.FileName.Substring(
this.file.FileName.LastIndexOf(".",
StringComparison.Ordinal) + 1,
this.file.FileName.Length -
this.file.FileName.LastIndexOf(".", StringComparison.Ordinal) -
1).ToLower();
fileName = this.file.FileName;
if (extensionType.Equals("csv"))
{
csv_file.Text = (fileName);
}
else
{
await this.DisplayAlert("Name of the file:" + file.FileName, "File info", "OK");
}
if (SettingsPage.loggingEnabled)
{
LogUtilPage.Initialize("/storage/emulated/0");
}
}
catch (Exception e)
{
await DisplayAlert("Alert", "Something went wrong", "OK");
if (SettingsPage.loggingEnabled)
{
LogUtilPage.Log(e.Message);
}
}
}

SharePoint 2010 "save conflict" message when editing list item with attachment

I have been trying to address an error generated in SharePoint 2010 that occurs when I update a list item that has a Microsoft Office document attached. If I make changes to the attached document (by clicking its link in the list item) and then attempt to save the list item I get the error message below.
save_conflict_error
I am trying to capture and deal with this error using the ItemUpdating event receiver
The receiver never catches the save conflict exception in the try catch.
I have tried everything that has been suggested in about 4 pages of google searches and I have run out of things to try. This is a last desperate attempt to find a solution (if there IS one).
Below is my code for the ItemUpdating event receiver.
public override void ItemUpdating(SPItemEventProperties properties)
{
try
{
base.ItemUpdating(properties);
using (SPSite site = properties.OpenSite())
{
using (SPWeb web = site.OpenWeb())
{
//determine list
if (properties.List.Title.ToLower() == "mytestlist")
{
web.AllowUnsafeUpdates = true;
this.EventFiringEnabled = false;
properties.List.Update();
} //endif
} //end using
} //end using
}
catch (Exception ex) {
{
//abort the update
properties.Status = SPEventReceiverStatus.CancelWithError;
properties.ErrorMessage = ex.Message;
properties.Cancel = true;
} //end try
}
} //end function
Here is my Elements.xml file also.
elements_xml
Thank you in advance.
:)

Blackberry: Make a iterative HTTP GET petition using Comms API

I want to store position coords (latitude, longitude) in a table in my MySQL DB querying a url in a way similar to this one: http://locationstore.com/postlocation.php?latitude=var1&longitude=var2 every ten seconds. PHP script works like a charm. Getting the coords in the device ain't no problem either. But making the request to the server is being a hard one. My code goes like this:
public class LocationHTTPSender extends Thread {
for (;;) {
try {
//fetch latest coordinates
coords = this.coords();
//reset url
this.url="http://locationstore.com/postlocation.php";
// create uri
uri = URI.create(this.url);
FireAndForgetDestination ffd = null;
ffd = (FireAndForgetDestination) DestinationFactory.getSenderDestination
("MyContext", uri);
if(ffd == null)
{
ffd = DestinationFactory.createFireAndForgetDestination
(new Context("MyContext"), uri);
}
ByteMessage myMsg = ffd.createByteMessage();
myMsg.setStringPayload("doesnt matter");
((HttpMessage) myMsg).setMethod(HttpMessage.POST);
((HttpMessage) myMsg).setQueryParam("latitude", coords[0]);
((HttpMessage) myMsg).setQueryParam("longitude", coords[1]);
((HttpMessage) myMsg).setQueryParam("user", "1");
int i = ffd.sendNoResponse(myMsg);
ffd.destroy();
System.out.println("Lets sleep for a while..");
Thread.sleep(10000);
System.out.println("woke up");
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("Exception message: " + e.toString());
e.printStackTrace();
}
}
I haven't run this code to test it, but I would be suspicious of this call:
ffd.destroy();
According to the API docs:
Closes the destination. This method cancels all outstanding messages,
discards all responses to those messages (if any), suspends delivery
of all incoming messages, and blocks any future receipt of messages
for this Destination. This method also destroys any persistable
outbound and inbound queues. If Destination uses the Push API, this
method will unregister associated push subscriptions. This method
should be called only during the removal of an application.
So, if you're seeing the first request succeed (at least sometimes), and subsequent requests fail, I would try removing that call to destroy().
See the BlackBerry docs example for this here
Ok so I finally got it running cheerfully. The problem was with the transport selection; even though this example delivered WAP2 (among others) as an available transport in my device, running the network diagnostics tool showed only BIS as available. It also gave me the connection parameters that I needed to append at the end of the URL (;deviceside=false;ConnectionUID=GPMDSEU01;ConnectionType=mds-public). The code ended up like this:
for (;;) {
try {
coords.refreshCoordinates();
this.defaultUrl();
this.setUrl(stringFuncs.replaceAll(this.getUrl(), "%latitude%", coords.getLatitude() + ""));
this.setUrl(stringFuncs.replaceAll(this.getUrl(), "%longitude%", coords.getLongitude() + ""));
cd = cf.getConnection(this.getUrl());
if (cd != null) {
try {
HttpConnection hc = (HttpConnection)cd.getConnection();
final int i = hc.getResponseCode();
hc.close();
} catch (Exception e) {
}
}
//dormir
Thread.sleep(15000);
} catch (Exception e) {
} finally {
//cerrar conexiones
//poner objetos a null
}
Thanks for your help #Nate, it's been very much appreciated.

how to create database in blackberry mobile

List item
i developed an application , in which uses sq lite database . this is running properly on simulater . but when we application deploy on Blackberry curve 8520 mobile then . tell us database does not exist. anyone know answer please quick response ...
My Code is ->
public static void insertData( String pass , String cpass)
{
boolean fl=false;
String root = null;
MainScreen ms = new MainScreen();
Enumeration e = FileSystemRegistry.listRoots();
while (e.hasMoreElements())
{
root = (String)e.nextElement();
if(root.equalsIgnoreCase("store/"))
{
fl=true;
}
}
if(!fl)
{
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
Dialog.alert("This application requires an SD card to be present." +
"Exiting application...");
System.exit(0);
}
});
}
else
{
String dbLocation = "C:/om12345/sql/res/store/";
// Create URI
// Statement st=null;
try
{
URI myURI = URI.create("file:///store/home/user/databases/database.sqlite");
//URI myURI1=URI.
d = DatabaseFactory.create(myURI);
Statement st = d.createStatement( "insert into Admin (pass, Cpass) values('"+ pass+"','"+cpass+"')");
st.prepare();
st.execute();
st.close();
d.close();
//ms.add(new RichTextField ("tata" + "tata1"));
// UiApplication.getApplication.invokeLater(pushScreeen(ms));
}
catch ( Exception e1 )
{
System.out.println( e1.getMessage() );
e1.printStackTrace();
}
}
You likely can't store a sqlite database on /store for the 8520. See my answer to BlackBerry SQLite database creation: "filesystem not ready" for more information on that.
You will first need to change the line that says " String dbLocation = "C:/om12345/sql/res/store/";" since that refers to a location on your development machine but will not work on a mobile device. You need to point to the 'res' folder in your application itself.
You can not create database into store directory if you are having less than 1gb internal storage & you have saved your data base in C directory , which can be accessible from your system, but not on device. So change its location copied into it res folder.
& check if you are having SD card then save your database using /SDCard.
If SDCard is not available than you will able to access database , if you are having more than 1GB internal storage
have a look on this link
http://docs.blackberry.com/en/developers/deliverables/17952/SQLite_database_files_1219778_11.jsp

message queue full error in blackberry

I have coded to get the info from the user and send an email of clicking a button. The program is getting executed for a while and then the simulator is crashing showing error
"DE427"-Message queue full... Here's the code that i have done...
if(field==SendMail)
{
Message m = new Message();
Address a = null;
try {
a = new Address("user#xyz.com", "Rahul");
} catch (AddressException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Address[] addresses = {a};
try {
m.addRecipients(net.rim.blackberry.api.mail.Message.RecipientType.TO, addresses);
m.setContent("Name:"+Name.getText().toString()+"\n"+ "Phone :"+Phone.getText().toString()+
"\n"+ "Date & Time:"+DateShow.getText().toString()+"\n"+"Make:"+Make.getText().toString()+
"\n"+"Model:"+Model.getText().toString()+"\n"+"Miles:"+Miles.getText().toString()+"\n");
m.setSubject("Appointment Request (Via Blackberry app)");
} catch (MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(m));
}
Can anyone tell me what the error is and how to rectify the problem....Plz...
It seems there is an issue with certain versions of Windows XP and the Blackberry simulator version. Check this link http://supportforums.blackberry.com/t5/Testing-and-Deployment/Simulator-quot-device-Error-DE427-quot/m-p/556321
If you clean up the simulator (delete .dmp files from simulator directory) and restart the simulator it works fine

Resources