01-13-2010 01:12 AM
There's no JDBC in the BlackBerry API. In short, your options are:
1. Setup a web service that exposes the SQL statements you wish to run from the phone. Have the phone make HTTP calls instead of SQL.
2. Port the JDBC driver for your database to the BlackBerry (and the java.sql package).
Can anybody please post some sample codes for above two examples.
01-13-2010 04:40 AM
I am not aware of any attempt to port JDBC to the BlackBerry. So I would not expect to get a response to your request for sample code for this.
Also you will probably already find sample code for your first option around. Your option of 'tunneling' SQL statements through http is a variation on many questions that have been asked on this forum. Have quick search for SQL.
In fact there is nothing special in this from the BlackBerry perspective, it just does http calls and receives the response. But you may find this communication is the hardest part of the process, so I suggest you start by investigating doing just that. There is sample code supplied with the JDE, or you could work through the Network Sticky Thread here:
Also, there are a number of blogs out there with sample http connection code, I particularly like the sample supplied by versatilemonkey.
From experience dealing with SQL data, you have to have some intelligence at the Server end and the Blackberry end to process this sort of request. There are performance, integrity, consistency and size issues when shipping data like this to and from the BlackBerry.
Have you considered Sybase's product. It may well do what you need it to do (it has sync facilities for example) already.
01-13-2010 05:29 AM
thanks for the post.
since your an expert can you please show me with an example as iam a newbie on BB and after 2 yrs touching java.
may be you developed any application with database connectivity.
I have downloaded the sybase anywhere but it requires a key but still they didnt email me .
may be you can provide me with one.
Any help is highly appreciated!!!
01-13-2010 08:36 AM
I've used two approaches to getting SQL data - the Server end of this code does connect to SQL data.
a) Used a http POST to format a request, the request was picked up some Php processing, which extract that data and sent it back in a format the BlackBerry code understood.
b) Used a socket connection to send a request, the request was picked up by a socket server and the data was sent back, again in a format the Blackberry processing understood (different to (a).
Note that the fact that the data was SQL is actually irrelevant, the BlackBerry asked for some information in a way that the Server code understood, and the Server code responded with the data in a way that the BlackBerry understood. And that is what you have to do. There is, as far as I know, no other option.
So you don't need SQL sample code, you just need connection sample code. You need to write the Server end and BlackBerry end to process data on whatever pipe you choose.
01-14-2010 04:52 AM
its been really nice talking and get guidance from you.
i have passed the stage of connection now i have used ASP.NET for connection to the database and then i am reading those responses in JAVA..
now what i decided is to get the data in xml from ASP.NET and then read it in java.
is there any help or example available by which i can read xml data.
01-14-2010 05:05 AM
How To - Use the XML Parser
Article Number: DB-00394
In addition, there are a few posts on this forum that talk about processing downlaoded XML data.
11-14-2012 04:47 AM
11-14-2012 05:04 AM
11-14-2012 09:14 AM
I am exposing the content of the sql content via a php web service...I just want to know, how must I construct the data so that I can use it....instead of it looking like this...
this is xml format, but I'm assuming json will be better