Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    May 2007

    I cannot send query string to the servlet

    hi every body,
    i have a midlet that connect to a servlet to get data from sql database.
    every thing works fine when i write the query string in the servlet;

    String query ="SELECT col1,col2 From tb1";
    and then excute the query in the servlet .

    The problem that i need to send the query string as a parameter with the connection.
    I tried this :
    HttpConnection c = (HttpConnection) Connector.open(url+"?query="+query);

    but i got this error : java.lang.IllegaArgumentException:Space character in URL

    i understood from the error that i cannot send parameter that contain spaces but i donot know how to send the query in any different way.

    plz guys i need urgent help


  2. #2
    Regular Contributor
    Join Date
    Aug 2006

    Re: I cannot send query string to the servlet

    Try to convert spaces into the "%20" chars (the standard space replacement for the URL). That probably will require some parsing functionality on the servlet's side, but that's may be the simplest solution to your problem. Also note, that if you may use HTTP POSTs instead of GETs, then try to send SQL queries as the HTTP request parameter, rather then a part of URL.

Similar Threads

  1. Need a PHP/HTML script which integrates with SDK and send sms
    By ramanladhani in forum Tools and SDK Feedback (Closed)
    Replies: 2
    Last Post: 2007-01-14, 10:56
  2. global root overflow(please help)
    By sushant_125 in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2004-05-14, 08:24
  3. How to send parameter (query string) via POST method?
    By pop2518 in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2004-01-25, 13:53
  4. How to send binary SMS???
    By le0n9 in forum Smart Messaging
    Replies: 1
    Last Post: 2003-03-26, 14:46
  5. nokia 7210 modem via IR doesn't work !
    By oussamaaiadi in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-03-06, 10:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts