BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 02-19-2010, 02:03 AM   #1 (permalink)
New Member
 
Join Date: Feb 2010
Model: 9500
PIN: N/A
Carrier: NA
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Arrow I want database contact to a remote server, not a server on a SD card.

Please Login to Remove!

Hi all,

I am very new to blackberry application development.
I wanted to connect database to my blackberry simulator.

I am able to retrieve values from a database which is located on a sdcard, but now I want to retrieve the data from MySql datadase server.

Can u guys plz help me in this...plz give some code details....

It's urgent..!!!
Offline  
Old 02-19-2010, 05:20 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Jan 2010
Model: 8900
PIN: N/A
Carrier: trainee
Posts: 30
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Reply

hi!
for making connection with database present on remote server u have have to write servlet at server side,which will be responsible for storing data on db.
Offline  
Old 02-22-2010, 03:50 AM   #3 (permalink)
New Member
 
Join Date: Feb 2010
Model: 9500
PIN: N/A
Carrier: NA
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi neha,

thnx for ur suggestion.
but I am using Blackberry JDE 5.0 in which database API is provided.
and till now what i've been doing is that my database was created on sdcard and code to access it is:

String dbLocation = "file:///SDCard/BlackBerry";
URI myURI = URI.create( dbLocation + "/databasename.db");
d = DatabaseFactory.open(myURI);
Statement stSelect = d.createStatement("SELECT Col1 FROM table1");
stSelect.prepare();
Cursor cursor = stSelect.getCursor();
while(cursor.next())
{
//do sumthing
}

I simply retieve the data from the table in the database and display it on the screen by clicking the application icon in the downloads tab on bb simulator 9550.

Now what i want is that instead of using the database on the sdcard I want to retrieve data from a remote server which is either on my machine or any other machine.

can u plz help in this and provide some code for the same.

Thx in advance!
Offline  
Old 02-22-2010, 08:17 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

There is no Blackberry API for connecting to a remote database.

As stated in the previous post, you'll need some type of server-side code to accept an HTTP GET or POST. Your server-side code will make the database query and return the data, probably in an XML or JSON document.
Offline  
Old 02-24-2010, 04:29 AM   #5 (permalink)
New Member
 
Join Date: Feb 2010
Model: 9500
PIN: N/A
Carrier: NA
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks, now I have created a servlet to insert data into MySQL database.

but how can I retrieve the data from database and display that data on the blackberry screen.

Thanks in advance!
Offline  
Old 02-24-2010, 07:07 AM   #6 (permalink)
Knows Where the Search Button Is
 
Join Date: Jan 2010
Model: 8900
PIN: N/A
Carrier: trainee
Posts: 30
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi!

do u know how to access database using servlet???? if yes thn,
use HttpConnection to communicate servlet with your device.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.