[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 963
  • Last Modified:

Designing a BlackBerry app for use on BES with MSSQL

I'm new to BlackBerry app development (and somewhat novice with Java, but I think I can manage it OK). I'm looking to write an app for our employees to use here. Our employees have BlackBerries connected to a BES. The idea is that the app would have connectivity through the BES (rather than out through the Internet) to the MSSQL server here, as the app will need to run some queries for them.

I'm not sure what the best approach to do this is. I have the BlackBerry Application Development/Eclipse environment set up and I've played around with some very basic "hello world" style apps, but I'd like to start playing with SQL queries. Is this done through JDBC, and if so, is there anything in particular that I have to do to install/enable it for use with BlackBerry development? I tried to import java.sql but the IDE says that it can't be resolved.

I tried to search for help with this but unfortunately most of the results I got back were dealing with the BES' MSSQL database itself, not app integration with MSSQL.
  • 8
  • 8
1 Solution

Some yaers ago - probably even 5 years already - I wrote some very basic applications for my blackberry
connecting to Oracle database.

The way I did it - i used of course BlackBerry Application Development/Eclipse environment
but I made minimum interface with it and
connected to SOAP web service on my server (Tomcat).
So I'm feeding SQL string to the web service are return
the results of the query back to my blackberry,
but all database connection is handled by the server.

It actually works even though I migrated to two new blackberiies since then,
and I forgot many detals - but it luckily nigrated automatically to next two generations of BB.
I may find this library which I used for BB client of SOAP,
though at that time it was very rudimentary - I'm sure it is much more developed
now. And perhaps now you can wrirte direct connection to DB easier,
than it was then.

elorcAuthor Commented:
I'm not familiar with SOAP. Our sites are all under IIS6 (soon to be IIS7). Is that something that works with IIS?

I just use SOAP as a synonym for web services
It is a protocol for communication which is used in Web Services

I was actually using kSOAP, see for instance, here

IIS6 or IIS7 - those are just  web servers

To use java based Web services  you need
in addition to web server also some java enabled web engine -
most commonly it could be Tomcat

I'm actually using Tomcat with Axis implementation of web services

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

elorcAuthor Commented:
This is really confusing. I wrote a very simple PHP web service to test with. In Eclipse, I created a new project and started tinkering with kSOAP, but when I run the app on the BlackBerry simulator it throws an error:

Error starting Test_Project: Module 'ksoap2-j2me-core2.1.2' not found.

What am I supposed to do to get kSOAP onto the simulator for testing?
Sorry, that I don't remember, but I did use simulator for developing and there
should be a way to add dependencies.
At that time I was using  their IDE which they provide from RIM, not Eclipse.
I think it was called JDE.
Yes, they have some Eclipse plugin so probably it should also work.
Yes, I see in my old folders that I was using Blackberry JDE 4.1.0
(it was in 2007). And I see that in the folder where I have Blackberry JDE 4.1.0
installed there is a lib folder and in there tehre used to be only
one jar which came with distribution net_rim_api.jar, and
I added there ksoap2-j2me-core-2.1.2.jar
I probably specified it somehwere in th project also.
Unfoertunately though I have all these old files I ahave now
different computer and without some pain I cannot recreate
the full environemnt (even thiough in general I think I should,
as I'm still using the applixcation which I worte and in case of emergency I need to be able
to modify it)

elorcAuthor Commented:
I tried adding it by right-clicking on my project, going to Properties, then Java Build Path. Under the "Order and Export" tab, I checked the box next to ksoap2-j2me-core2.1.2.jar, hit OK, and tried to build it again. This time, it gives me a build error:

org.ksoap2.SoapEnvelope: Error!: Missing stack map at label: 30

I'm not sure what that means. This article seems to suggest the process I used is correct, though:

Run a MIDlet Application in the BlackBerry Smartphone Simulator
To tell you the truth, I rememebr that in the end I did some
part of this envelope decoding manually as I could not overcome some
problme with this ksoap. But I thout it was because I wanted to
return back not just string and number but rather Vector - and with that
I had some problems, but when I think I made .toString() of waht I was receiving or something,
I reliazed that I could extract this final step myself.
I'll look around, I shoul find my code.
But I though with simple first case of Hello world, typ it worked for me in the regular way.
elorcAuthor Commented:
I'm trying to preverify ksoap2 with no success. Using the following command:

preverify -verbose -d c:\temp\k -classpath c:\eclipse\plugins\net.rim.ejde.componentpack4.6.0_4.6.0.23\components\lib\net_rim_api.jar c:\temp\k\ksoap2-j2me-core-2.1.2.jar

It spams through a bunch of text and then dies with:

jar -cvfm "c:\temp\k\ksoap2-j2me-core-2.1.2.jar" tmp31547\\META-INF\MANIFEST.MF -C tmp31547 .
Error: No such file or directory
JAR file creation failed with error -1

All of the files mentioned there exist.

c:\temp\k\ksoap2-j2me-core-2.1.2.jar - exists
tmp31547\\META-INF\MANIFEST.MF - exists

I'm not sure what MANIFEST.MF is supposed to contain, but this is all that is in my copy:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_07-87 ("Apple Computer, Inc.")

So what's the deal with this thing?
elorcAuthor Commented:
I think I figured it out. After a lot of trial and error, I determined that JDK was not set up properly in my PATH variable. The "no such file or directory" error appears to be referring to the JAR command that was being run. After adding it to the path, it completes the preverify steps.

I removed the old ksoap2 reference, added the new one, compiled and the simulator started successfully. Unfortunately, the app isn't working but I believe that's an issue with me not correctly using ksoap.

If I just wanted to do a very simple call to a PHP web service that accepts no parameters and returns a string, what would the code look like? I'm trying to get a starting point but unfortunately the ksoap references I've reviewed seem to do things a bit differently from one another, and I'm not sure which method is correct.
I found my client side code - maybe you'll
find it useful.
It is exactly as it works - i only changes some names

One is application which retirievs resultset from databse, through
Axis web service
Another application is for update of databse
They assume that sql string is sent - that string is being typed on the
blackberry screen
The query clien receives back the vector of lines - each line corresponds to the
row of result set which is concatenated to string on the sevrver side
of the web service.
Look, if you find it useful, I can try to find the server code either

And this is very basic - it does not use any wsdl or anything -
just dropped .jws files into the server axis directory and nothing elase

And I used (and continue using) exactly the same jar file you have

elorcAuthor Commented:
Actually it looks like it's not working because I can't access the internet from the simulator. So I guess that's my next battle. :)
Oh yes - to access that I think you need to start emulator of MDS or something like that - you know it is that part of blackberry
that allows you tomconnect to intranet I guess, so I rememeber I was starting  a special process when debugging
to emulate that
elorcAuthor Commented:
Cool, thank you. I'll take a look for it and let you know how things work out.

And thank you for submitting your code, I'm going to take a look at it to get a feel for how this ksoap thing works. :)
elorcAuthor Commented:
Perfect! I found the MDS simulator and got it running. Now to get my ksoap stuff working. Thank you so much for all of your help!
Great! I'm happy, if this my exprience perhaps would not die with me, but could be of some use
to someone else.

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 8
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now