I am trying to connect to a database through j2me app and send two strings.It gives me

java.lang.SecurityException: Application not authorized to access the restricted API

error. (Caught in the try catch block)

import java.io.*;
import javax.microedition.io.*;
import java.util.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class storeNumbers extends MIDlet implements CommandListener, Runnable{

  private Display display;
  public static Form form;
  private Command exit, store, back;
  private ChoiceGroup list;
  private int index;
  int test;
  private Alert alert;
  
 public void startApp() {

        display = Display.getDisplay(this);


}
 public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {

           notifyDestroyed();
    }

 public void commandAction(Command c, Displayable d) {

            String label = c.getLabel();
           



         if(label.equals("Store")){

             boolean selectedNumbers[] = new boolean[list.size()];
             test = list.getSelectedFlags(selectedNumbers);

             /************printing selected numbers/ forwarding to run()*************/

             if(test!=0){


                 try{
                    for (int i = 0; i < selectedNumbers.length; i++) {


                              if (selectedNumbers[i]) {

                                   System.out.println(list.getString(i));
                                   
                                
                                  Runnable runnable = new storeNumbers();
                                  t = new Thread(runnable);
                                  t.start();
                              }

                          }
                  
                           alert.setString("Selected numbers were successfully sent to the server");
                            alert.addCommand(back);
                            alert.setTimeout(5000);
                            display.setCurrent(alert);

                            form.deleteAll();
                            
               
                 }catch(Exception e){System.out.println(e);System.out.println("Error @ sending to the server");}

             }else{

                    noNumbersAlert = new Alert("No numbers are selected");
                    noNumbersAlert.setTimeout(5000);
                    display.setCurrent(noNumbersAlert);
                    System.out.println("No numbers are selected");
                 
            }
             

             

             /****************************************************/

           
         }else if(label.equals("Exit")){

                   destroyApp(false);

         }
    }

 


     } catch (IOException ex) {
            ex.printStackTrace();
        }

     }


  public void run() {
        
            try {

              ConnectWSPortType_Stub service = new  ConnectWSPortType_Stub();
              
              //service.store(num1,num2);
              
              System.out.println("Connecting...");

         }catch (Exception e) {
             System.out.println(e.toString());
        }
    }

Q1.
I remove the thread and called it directly from the command action event. Then it says it should be a separate thread. Then it gives the above error.
Please help me with this.

Q2. I want to pass the values to the run method from commandAction method how can I do that.

In run() method I have called the stub generated from the web service. That part works fine.

I found the solution for the Q1 which I had to call the thread from a separate method and call that method from the commandAction method.

Q2 still stands : how to pass parameters to run() method of a thread??