| Reply | « Previous Thread | Next Thread » |
|
I have installed Oracle10g in the server and using servlet to get it connected with the database in the server. I am using tomcat. I have created a table in the server(Oracle10g) and used odbcjdbc for connection.The connection is working.
Now i want to take some data from the Oracle10g database (which is installed in the server ) and save it in the mobile so that it can be viewed offline too. How to do that. Can i get the code and the concept of doing so. Things i think what i know is, in mobile phone we can only store in bytes. How to get the data from the database conver it into bytes and store in the mobile.Do i need RMS and if so how to use it. (codes needed) Need help in that. CLDC using midlet. Thanks in advance. do mail me at vinoy_george99@yahoo.com Thank you. |
| vinoy_george99 |
| View Public Profile |
| Find all posts by vinoy_george99 |
|
exactly what data u want to store in database?
byte conersion is possible in j2me language..dou u want to save data runtime? |
| snehalpatil |
| View Public Profile |
| Find all posts by snehalpatil |
|
Quote:
for example: Suppose there are some tables in the Oracle10g which is installed on the server side and when i connect that data i should be able to save it in my mobile and should be accessible offline. Is it clear? I have made a small application till now. I have created a table(having a columns username and password) in the Oracle10g which is installed in the server side . I made a http connection. I have made a simple username- password textfield and check with the database where it is valid or not. I use MyEclipse. Further my task is to take some thing from the database and store it in the mobile. So that it could be displayed even offline. Thanks in advance. |
| vinoy_george99 |
| View Public Profile |
| Find all posts by vinoy_george99 |
|
Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
raj_J2ME
Offline
Forum Nokia Champion
|
|
Hi,
What you are thinking ...using RMS is correct.You can save the data in RMS as far as mobiles are concern.. You can read the data that you wana save.Then you can convert that data in bytes and lastly you can save the data. For this you read the basic concepts of RMS..can be found on google.. or you can try these links out.. www.ibm.com/developerworks/library/wi-rms http://www.java2s.com/Code/Java/J2ME...alityofRMS.htm http://developers.sun.com/mobility/m...s/databaserms/ Hope that these lines can help you out..yes.. Thanks Thanks R a j - The K e r n e l |
|
I have read all those links. As i have said i have managed to display the data from the database. But i am not getting how to save those data's into my Mobile. I also got where is makes the file and stores things. I also created the record but i am not able to stored those data's which i earlier said that i had displayed.
I did a lot of R & D but failed. Can i get your email id so that i can send my codes to you and check what is wrong in it.or just add @yahoo.com to my username to mail me. Thanks in advance. Regards, Vinoy |
| vinoy_george99 |
| View Public Profile |
| Find all posts by vinoy_george99 |
|
This is my MIDLET.java
package MidletPack; public class s_Midlet extends MIDlet implements CommandListener { private static final Command CMD_Exit = new Command ("Exit", Command.EXIT,1); private static final Command CMD_Login = new Command ("Login",Command.SCREEN,1); private static final Command CMD_Back = new Command ("Back", Command.BACK,1); private static final Command CMD_Select = new Command ("Select",Command.OK,1); private boolean firstTime; private Form mainForm, waitingForm; private Display display; private TextField txtUname, txtPass; private static final String TICKER_TEXT ="Gujarat Sysport Service Pvt Ltd. PROCURE plus - premium e-procurement solution "; private Ticker t; private String sMainData =""; private ChoiceGroup chgMenu=null; public s_Midlet() { // TODO Auto-generated constructor stub display = Display.getDisplay(this); mainForm = new Form (" Welcome To Sysport Mobile Application"); waitingForm = new Form ("Processing"); firstTime=true; try { ImageItem lg = new ImageItem ("", Image.createImage("/logo.jpg"), ImageItem.LAYOUT_CENTER | ImageItem.LAYOUT_NEWLINE_BEFORE | ImageItem.LAYOUT_NEWLINE_AFTER, ""); mainForm.append(lg); } catch (IOException e){ mainForm.append (new StringItem ("Copyright", "Sysport Publishing; Image not available:" + e)); } txtUname = new TextField("UserName:","",8,TextField.ANY); txtPass = new TextField("Password:","",8,TextField.PASSWORD); } protected void destroyApp(boolean arg0) throws MIDletStateChangeException { // TODO Auto-generated method stub } protected void pauseApp() { // TODO Auto-generated method stub } protected void startApp() throws MIDletStateChangeException { // TODO Auto-generated method stub if(firstTime){ t = new Ticker(TICKER_TEXT); mainForm.setTicker(t); firstTime=false; mainForm.addCommand(CMD_Exit); mainForm.addCommand(CMD_Login); mainForm.append(txtUname); display.setCurrentItem(txtUname); //set the focus on the username textfield mainForm.append(txtPass); mainForm.setCommandListener(this); display.setCurrent(mainForm); display = Display.getDisplay(this); } } public void commandAction(Command c, Displayable d) { // TODO Auto-generated method stub if(c==CMD_Login){ try{ display.setCurrent(waitingForm); Thread t = new Thread(){ public void run(){ try { CheckUnamePassword(txtUname.getString(),txtPass.getString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; t.start(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (c == CMD_Exit) { try { destroyApp(false); } catch (MIDletStateChangeException e) { // TODO Auto-generated catch block e.printStackTrace(); } notifyDestroyed(); } if (c == CMD_Back){ loadForm(sMainData); /* display.setCurrentItem(txtUname); //set the focus on the username textfield display.setCurrent(mainForm); txtUname.setString(""); txtPass.setString(""); */ } if (c == CMD_Select) { try { Thread r = new Thread(){ public void run(){ try{ //your function call sValue(); }catch(Exception e){} } }; r.start(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } // sValue(); // } } //end commandAction public void CheckUnamePassword(String name, String password)throws IOException { if(name.equals("") && password.equals("")){ blankFldAlert(); } else { HttpConnection httpConn = null; String url = "http://172.16.1.137:8000/File_Servlet/servlet/File_Connection?uName="+name+"&sPass="+password; InputStream is = null; OutputStream os = null; try { // Open an HTTP Connection object httpConn = (HttpConnection)Connector.open(url); // Setup HTTP Request httpConn.setRequestMethod(HttpConnection.GET); httpConn.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Confirguration/CLDC-1.0"); /** Initiate connection and check for the response code. If the response code is HTTP_OK then get the content from the target **/ int respCode = httpConn.getResponseCode(); if (respCode == httpConn.HTTP_OK) { StringBuffer sb = new StringBuffer(); os = httpConn.openOutputStream(); is = httpConn.openDataInputStream(); int chr; while ((chr = is.read()) != -1) sb.append((char) chr); String sResult= sb.toString(); sMainData = sResult; if(sResult.equals("")){ logInCorrectAlert(); } else { loadForm(sResult); } } else { System.out.println("Error in opening HTTP Connection. Error#" + respCode); } } finally { if(is!= null) is.close(); if(os != null) os.close(); if(httpConn != null) httpConn.close(); } } //end else }// end check user name password public void blankFldAlert(){ Alert error1 = new Alert("Login Incorrect", "Please fill your text field.", null, AlertType.ERROR); error1.setTimeout(2000); //txtUname.setString(""); //txtPass.setString(""); display.setCurrent(error1,mainForm); } public void logInCorrectAlert(){ Alert error = new Alert("Login Incorrect", "Invalid Username Or Password", null, AlertType.ERROR); error.setTimeout(2000); txtUname.setString(""); txtPass.setString(""); display.setCurrent(error,mainForm); } public void loadForm(String sRs){ Form f5 = new Form("Welcome "+txtUname.getString()); String choice[] ={"View Data"," Add Data"}; chgMenu = new ChoiceGroup("Select Option : ",ChoiceGroup.EXCLUSIVE,choice,null); chgMenu.setPreferredSize(chgMenu.getPreferredWidth()+4/2,-1); f5.append(chgMenu); f5.setCommandListener(this); f5.setTicker(t); f5.addCommand(CMD_Back); f5.addCommand(CMD_Select); f5.setCommandListener(this); display.setCurrent(f5); }// end of loadForm Method public void sValue(){ int j = chgMenu.getSelectedIndex(); String sValue = ""; if(j == 0){ sValue = "View Data"; } if(sValue.equals("View Data")){ try { getViewData(txtUname.getString(),txtPass.getString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public void getViewData(String name,String password)throws IOException{ HttpConnection httpConn = null; String url = "http://172.16.1.137:8000/File_Servlet/servlet/getViewData?uName="+name+"&sPass="+password; InputStream is = null; OutputStream os = null; try { // Open an HTTP Connection object httpConn = (HttpConnection)Connector.open(url); // Setup HTTP Request httpConn.setRequestMethod(HttpConnection.GET); httpConn.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Confirguration/CLDC-1.0"); /** Initiate connection and check for the response code. If the response code is HTTP_OK then get the content from the target **/ int respCode = httpConn.getResponseCode(); if (respCode == httpConn.HTTP_OK) { StringBuffer sb = new StringBuffer(); os = httpConn.openOutputStream(); is = httpConn.openDataInputStream(); int chr; while ((chr = is.read()) != -1) sb.append((char) chr); String resultVwDetails = sb.toString(); Form viewDt = new Form("My Details "+txtUname.getString()); viewDt.append(resultVwDetails); viewDt.addCommand(CMD_Exit); viewDt.addCommand(CMD_Back); viewDt.setCommandListener(this); display.setCurrent(viewDt); } else { System.out.println("Error in opening HTTP Connection. Error#" + respCode); } } finally { if(is!= null) is.close(); if(os != null) os.close(); if(httpConn != null) httpConn.close(); } }// end of getViewData } //end main_Midlet[/size][/size][/font][/size] |
| vinoy_george99 |
| View Public Profile |
| Find all posts by vinoy_george99 |
|
Requirement:
The Language Training application to provide language support in terms of voice for subscribed users. user need to enter the user name and pass word,these details need verify from the webserver contents,if user is valid user next screen to display will be list of items like Banking,Bus stop,post office,railway station etc,when user select the one of these items,it needs to get list of audio files containg normal dicussions like how to ask for the in kanada for what is your name etc. Can u suggest for usage of server and how much time it will take to complete the requirement. |
|
For this we have the Record Management store(RMS) wherein u can persist data.there are j2me classes to store data in mobile phones...look at the links which raj has given u...
|
| mickeystaines |
| View Public Profile |
| Find all posts by mickeystaines |
|
Hi
RMS doesn't allow u to access the filesytem registry of ur mobile, so if u've to store the data into mobile u need to select the file on memory stick, so u need access to the fileregistry, so try using javax.microedition.io.*; package to storing the data..... |
|
You can store the data in two ways in mobile:
1. In RMS, 2. At Filesystem(memory card). If the data is large in size then its much better to use Filesystem to store data but in case of lesser amount of data u can use RMS to store it. Both of the techniqes needed data in bytes form to store. Better to read about both of them over net.. thanks, jitu_goldie.. KEEP TRYING.. |
| jitu_goldie |
| View Public Profile |
| Find all posts by jitu_goldie |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Automatically sending sms from web server to mobile through smsc server | anthonypeter | General Messaging | 8 | 2009-01-11 12:19 |
| Mobile Podcasting - will it happen? | mobile monte | News, Announcements and Job Listings | 0 | 2006-09-23 00:45 |
| how to use udp, for sending data server to client | acayir | Mobile Java Networking & Messaging & Security | 1 | 2006-08-02 20:18 |
| 6600 gprs 发送大量rtp延时问题 | dicson_hu | Symbian | 9 | 2005-11-04 03:12 |
| Cannot to receive data from server... | ramis55 | Symbian Networking & Messaging | 0 | 2005-05-09 14:46 |