Anshal Patel

Ranch Hand
+ Follow
since Feb 07, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anshal Patel

I use xp professional Paul.And its just that I want to take my project to the next level that I would want to connect it via internet.

I already have my project working on LAN.

So my simple question is how do I use my mobile to connect to some database which is a server.

12 years ago
I already use apache 6.0 tomcat for localhost connectivity

now I am doing some R&D using httpd but dunno how it works.

It says i need to put the web server pages in htdocs.

But i have servlets and that cannot be shifted to the doc folder.
12 years ago
Hi all,I have created a mobile application which runs fine over LAN (between two pcs).Now I would like to make the data available on my mobile phone using GPRS.

So how do i make my pc as a server and make it accessible from internet just as the same way I did it on LAN considering that I just have 2 servlets which would be stored in the web-inf folder (i am using apache).

best regards,
Anshal
12 years ago
issue resolved thanks to all
i have printed the variable and it works fine

I just need to know how to bind the parameter and my project is all done.


The above query returns a null,here disquery is type of string where as this thing returns proper answer


The connectivity issue is solved.I created a DSN for the same.

But now I have an error in the sql query.



It doesnt work

but this works


how do i put my parameters in the query
do you mean sqljdbc.jar

the following is my classpath variable

C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar;C:\Microsoft SQL Server JDBC Driver 2.0\sqljdbc_2.0\enu\sqljdbc.jar


the problem is i get the exception ClassNotFoundException
when I register the drivers you wrote com....

I request the admin to delete this thread as I have posted a new topic with a new title considering that I made a mistake.

Please delete this thread
Hello everyone I am facing a problem when I try and connect my servlets to sql2000 database.

As a classic way Connection con is defined and Statement stmt is defined.

In the following code even after a series of sql queries and registering the drivers
both 'con' and 'stmt' are null till the end

At the end(before closing it) I modified if statement by printing error if con==null and it did get printed.

Please help me to understand the error

The code is as follows

thanks a ton i have created the code and now waiting to get my jdbc problems resolved
12 years ago
I have picked the paramters using getParameter() and processed the the variables in database and stored them in a string object by

msg=res.getString(1);

now my question is how do i print the data in string obj 'msg' inside a textbox on mobile emulator
12 years ago
Thanks a ton alexander for the quick reply.

I understood what you said perfectly.

Now I have few questions.

1)In this code tbox = new TextBox("Hello world MIDlet", "Hello World!", 25, 0); can i replace "Hello World " with some string object.

2)Could you please verify whether the code is right for sending data to the servlet.

3)Can you guide me as how to retrieve data from the servlet.

Following is my code

public void connect()

{
try
{
HttpConnection httpconnection = (HttpConnection)Connector.open(url);
System.out.println("url is" + url);
httpconnection.setRequestMethod(httpconnection.POST);
httpconnection.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Configuration/CLDC-1.0");
httpconnection.setRequestProperty("Content-Language", "en-US");
//byte abyte0[] = connData.getBytes();

// httpconnection.setRequestProperty("Content-Length", ))
OutputStream outputstream = httpconnection.openOutputStream();
byte abyte0[] = connData.getBytes();
for(int i=0;i<abyte0.length;i++)
{
outputstream.write(abyte0[i]);
}

outputstream.flush();
outputstream.close();
System.out.println("Connected Successfully");

int i = httpconnection.getResponseCode();
System.out.println("RC" + i);

if(i != 200)
throw new IOException("HTTP response code: " + i);
DataInputStream inputstream = httpconnection.openDataInputStream();
int j = (int)httpconnection.getLength();
System.out.println("Length of inputstream is :"+j);
byte abyte1[] = new byte[j];
int k = inputstream.read(abyte1);
System.out.println("Length inputstream.read is :"+k);
String abc=httpconnection.getResponseMessage();
String s = new String(abyte1,0,k);
System.out.println("string is:" + s + "******************************"+abc);



}
12 years ago