Hi ,
I am developing a Palm App with J2ME and CLDC API's.
I made a sample application and tested in Kyocera Palm device and i am so thrilled to run it.
Now i want to make my application to communicate with a remote Oracle database.For this i am planning to make my Palm application to talk with
Servlets in a webserver, so that i can send and recieve data extensively.
But i am not able to do the communication module successfully.
I tried out a sample code and it didn't throw any exception and the return values of every function said it is sucess.So i thought i did all !!!
And later i tried with a jung (invalid) URL and i got shocked to see the same result ..i mean no error.All the branches of the program returned success values.
What does it mean ??? So my application actually not contacting any URL. Otherwise it should throw some invalid URL exception.....right ?
But in both the cases the number of bytes returned by read function was 0 and none of the other connection function throwed any exception,
like connect(),OpenInputStream...etc.
This is my sample code.
-----------------------------------------------------------------
StreamConnection m_Conn = null; //Connection
DataInputStream m_In = null; //Input Stream
String sURL = "http://63.221.48.58:8080/servlets/AirScriptLogin";
try
{
StringBuffer sbInput = new StringBuffer("");
int iData;
int iCount = 0;
m_Conn = (StreamConnection)Connector.open(sURL,Connector.READ_WRITE,true);
m_In = m_Conn.openDataInputStream();
for(iCount = 0 ; (iData = m_In.read()) > 0 ; iCount++)
{
sbInput.append((char)iData);
}
m_In.close();
MsgTxtBox.setText("Recd :"+sbInput.toString());
MsgTxtBox.paint();
}
catch (RuntimeException e)
{
MsgTxtBox.setText(e.getMessage());
MsgTxtBox.paint();
}
catch (Exception e)
{
MsgTxtBox.setText(e.toString());
MsgTxtBox.paint();
}
------------------------------------------------------------------------
If i understood anything wrongly pls correct me.And pls tell me what should i do....i am really in a trouble.
Pls let me know if u need any more info ,so that u can give me a better reply.
Hope to hear from u soon.
Thanks and Regards
Joe Augustine