We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Designing a BlackBerry app for use on BES with MSSQL

Medium Priority
999 Views
Last Modified: 2012-05-11
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.
Comment
Watch Question

Awarded 2011
Awarded 2011

Commented:

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.






 

Author

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

Commented:

I just use SOAP as a synonym for web services
It is a protocol for communication which is used in Web Services
http://en.wikipedia.org/wiki/SOAP

I was actually using kSOAP, see for instance, here
http://drdobbs.com/mobility/208800166

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


Author

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?
Awarded 2011
Awarded 2011

Commented:
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.
Awarded 2011
Awarded 2011

Commented:
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)


Author

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
Awarded 2011
Awarded 2011

Commented:
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.

Author

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?

Author

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.
Awarded 2011
Awarded 2011
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

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. :)
Awarded 2011
Awarded 2011

Commented:
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

Author

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. :)

Author

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!
Awarded 2011
Awarded 2011

Commented:
Great! I'm happy, if this my exprience perhaps would not die with me, but could be of some use
to someone else.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.