07-22-2013 09:45 AM - edited 07-22-2013 09:54 AM
Hi, I am tring to develop blackberry SmartPhone web apps by using Web Work platform, but my backend database is SQL Server database 2008, can anybody help me with some tutorials, examples of how to connect the SQL database in Web Work?
Thanks a lot for any help,
07-23-2013 03:54 PM
07-23-2013 07:49 PM
Hi, thanks for your help, but I do not any experience about coding that, it may be hard for me, this is the first time programming blackberry.
But I want to try another way - using ASP.net MVC to create a Mobile web project which is simple, since SQL server database can be easy set as its back end database, so there are no problem in this point. Finally, the ASP.net mvc mobile web project can be built and deployed to a web server. After some testing in Blackberry simulator by manully enter the URL of that web site, it is working fine.
Now, my question is how to make this web project working in the real blackberry handheld which hosted by BES server?
If my understand correctly, basically, an icon should be created in Blackberry handheld with other default icons, user click this new icon , it will launch that MVC mobile web apps hosted by the web server on the blackberry screen. I just do not know how to make this work? or if there are any other ways to achieve this goal.
Please let me know if you have any good idea or examples, thanks for your help again.
07-24-2013 11:23 AM
If you've written a web-server hosted application then you're ~98% of the way there :-)
What you can create is a Web Launcher that will open the external URL; the only "downside" is that the user will require an active data connection in order for your application to function.
Check out this tutorial here:
The main difference with your approach is that you don't need an index.html, since all your content is external. The only file you need is a config.xml.
<?xml version="1.0" encoding="UTF-8"?> <widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="220.127.116.11" id="HelloWorldApp"> <name>helloWorld</name> <author>My name</author> <description>The classic first app</description> <icon src="images/icon.png"/> <content src="http://www.mydomain.com/externalpage/index.html"/> </widget>
From there, you simply package the config.xml (no other files required - well, maybe icon.png) and then you will have an application (BAR file) that launches an external URL and should be able to run the content there.
You may need to look into <access> elements for your config.xml to ensure you are able to reach any external URLs your application uses:
Basically, any external URL (your content, the SQL server, etc.) will need a unique <access> element that whitelists the location to be accessible.
Beyond that, the tutorial is a good guide for pacakging the config.xml into an app, but do let us know if you have any questions.
07-24-2013 09:10 PM - edited 07-24-2013 10:46 PM
Hi, thanks a lot for your details information, that is really help,
More question though.
1. Where should I create that Web Launch? Should I create in BES server some directories or somewhere? Should I add the .bar file to somewhere in BES of production environment.
2. My asp.net mobile apps is not built on WebWorks, do I still need to select WebWorks when packaging my apps?
3. Before implementing to produciton, I need test it in development environment which can only choose a few pilot users, how to implement that?
4. Besides the Index.html, do I need all of the steps in that instructions you posted? For example, Ripple emulator, Blackberry SDK, et. By the way, we use Blackberry Smartphone 9900, 9630 and 9630 handhelds.
5. we have 1000 blackberry users, but only 100 users use this asp.net web apps, the rest users do not need it. so the new application icon should not be show on the users who do not need them,
This comes to another question, Should I push the new apps icon to those 100 users by PIN or what? Or should I add the application to the Application folder on user's blackberry hand which only 100 people can download it to their machine, the rest users can not download it. I do not know what is the standard way.
My asp.net MVC Mobile apps is almost done, I need to implement it to real blackberry handheld now, I called RIM to create an PR, but no answer yet. I appreciate if you can help me to resolve these issues,
Thanks a lot again,
07-25-2013 12:42 PM
Hi Peter, apologies my previous response was directed at BlackBerry 10; while some if it does apply, I'll do my best to answer your questions from a BBOS perspective.
Note that WebWorks is simply an HTML5 app packaged to run on the device, but it can run external content as well as long as that external content is web-based. If your browser can access the external content, then a WebWorks app generally can as well. In our case, we won't actually package any HTML5 content inside of our app, but simply package a config.xml file that points at your ASP content to load.
You will want to use the tools available here:
Specifically the BlackBerry WebWorks SDK.
Next, you'll want to create a folder that contains a config.xml file. You can find a sample here for BlackBerry 7 and earlier:
You can use the documenation here for more information on specific elements,
However the most basic config.xml that you can start with would look as follows:
<?xml version="1.0" encoding="utf-8"?> <widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="2.0" rim:header="RIM-Widget: rim/widget"> <author>Your Name</author> <name>Your App Name</name> <content src="http://path/to/external/url" /> </widget>
From there, you would need to look at adding <access> elements to allow access to external URLs as well.
Once you have your config.xml file in your project folder (i.e. C:\MyProject), you can ZIP the contents (so that config.xml is at the root of the ZIP file) and then run the bbwp command on the ZIP file to create a COD file of your application. A COD is the BBOS container for an application.
Information on packaging:
How to package:
Once you've packaged the application and signed the COD file, you can distribute that COD file to users however you choose. The easiest way is likely to host the JAD/COD file(s) on a web server and have users browse to the JAD file, which will then prompt them to install the application.
You can find hosting options here:
However when it comes time to distribute the application to BES users, the best bet is to reach out to your BES administrator who will be able to create a functional group on the BES of users that should have the application, and then they would push the COD file to those users specifically. This way only the people that are supposed to have the application will get it.
There's quiet a bit of information up there, so don't hesitate to ask any questions.
07-25-2013 01:30 PM
Thank you so much for your quick and details response, your response is really helping a lot,
After the .COD file is create, I guess then that is all BES Admin's job of how to push the Cod file to those specific group users. Glad to know this asp.net MVC mobiles web apps can be implemented to blackberry. I will let you know if I encounter any more issues.
Now, since my Mobile project is just in the proof of concept stage, basically, we want to compare the best way to acheive our goal. Now, comes back to the Blackberry Platform Chioces, there are 6 choices in blackberry site for development a Blackberry apps. since our back end data is a SQL server database, we need to make those data avaialble on blackbery smartphone, so I want to know what is the best way between the ASP.net MVC Mobile and those 6 platform choices, the pro and con for each method, then my management will approve based on the result.
Since I can not find any valuable information about connecting SQL server database from 6 Platform choices, I know in previous post, you mentioned about using Ajax to link SQL, but that link still can not help me out as I have never done that before.
In one word, if you can provide me some details tutorial, documentation about linking back end SQL database from those 6 blackberry platform choices, then I may worth to try it and compare it with the asp.net method.
Please let me know ,
Thank you so much for your kindly help againj,
07-25-2013 02:16 PM
Regarding the platform choices, we can simplify it a little. Since you are targeting BBOS, we can eliminate AIR, Native/Cascades, and Android.
This leaves us BlackBerry Java and HTML5 (WebWorks.)
Currently, the communication to the SQL database occurs on the server. Even if we are packaging an application that runs on the device; the device is actually hosted on your server, and that server is what is actually communicating with the database.
If you wanted to initaite the communication on the device, we would still require a server. The client would need to make a web request to the server, which would then access the database, and return the results to the client. On Java, you would make an HttpConnection request and on WebWorks you would make an XMLHttpRequest.
However, your current approach is just fine. Specifically that the functionality already exists on your back-end server and your application is simply rendering a front-end. The WebWorks approach is actually ideal here since it is a web view already that displays HTML content. If you went the Java approach, you could embed a BrowserField that shows the content; but it is additional effort on your part when you can simply package a config.xml (as opposed to writing Java classes and implementing Java APIs.)
For this, my recommendation would be the Webworks (HTML5) approach of packaging the config.xml; the one caveat is that your users will require a valid internet connection to your intranet in order to access your internal server. If they do not have a connection, the app will not be able to load the external data that is hosted on your ASP server.
This tutorial shows how to connect a client-side app to a backend database:
Note that the front-end is just a UI that makes requests to a server (PHP) and the server actually does the heavy lifting before returning the results back to the client. The client can not directly access the SQL server without a middle-man.
The difference in Java is that you would make that connection in a slightly different way.