title: How to Switch to OTA Provisioning option in Wireless toolkit J2ME?
body: <p>I am new to J2ME and now I have to solve one J2ME project.<br>
  Below is my login form I don't know what to do with that but it is giving me the error <strong>"javax.microedition.io.ConnectionNotFoundException: TCP open"</strong>. After searching on the google I got some hint that we have to run the code on <strong>"OTA Provisioning option "</strong>.<br>
  Now I don't know how to do that. I have <strong>"Version 2.5.2 for CLDC"</strong> of WTK. Can anybody suggest me on that?</p>
  
  <pre><code>package model;
  
  import java.io.ByteArrayInputStream;
  import java.io.ByteArrayOutputStream;
  import java.io.DataInputStream;
  import java.io.DataOutputStream;
  import javax.microedition.rms.RecordEnumeration;
  import javax.microedition.rms.RecordStore;
  import view.Dialogs;
  
  public class Login {
      public static RecordStore rs;    // Record store
      static final String REC_STORE = "db_Login"; // Name of record store
      static  RecordEnumeration re;
      private String login,password;
      private int c;
      public static String s1,s2,s3;
  
      public Login()
      {
           if(LoginSrv.st1.equals("Invalid") &amp;&amp; LoginSrv.st2.equals("User"))
         { 
             System.out.println("Im from Invalid User");
             new Dialogs();
         }
  
         else
         {
          login = LoginSrv.st1;
          password = LoginSrv.st2;
          c= LoginSrv.it1;
          saveRecord();
         }
      }
      public Login(String log,String pas, String ctr)
      {
          s1 = log;
          s2 = pas;
          s3 = ctr;
  
      }
      public void saveRecord()
      {
          try
          {
                  rs = RecordStore.openRecordStore(REC_STORE, true );
                  re = rs.enumerateRecords(null, null, false);
                  ByteArrayOutputStream baosdata = new ByteArrayOutputStream();
                  DataOutputStream daosdata = new DataOutputStream(baosdata);
                  daosdata.writeUTF(login);
                  daosdata.writeUTF(password);
                  daosdata.writeInt(c);
                  byte[] record = baosdata.toByteArray();
                  rs.addRecord(record, 0, record.length);
                  System.out.println("Login record added");
  
          }
          catch(Exception e)
          {
              System.out.println("Im from model Login craete record"+e);
  
          }
  
      }
      public static Login getRecord()
      {
  
          try
          {
              rs = RecordStore.openRecordStore(REC_STORE, true );
              re = rs.enumerateRecords(null, null, false);
          if(re.hasNextElement())
          {
             byte data[] = rs.getRecord(re.nextRecordId());
             ByteArrayInputStream strmBytes = new ByteArrayInputStream(data);
             DataInputStream strmDataType = new DataInputStream(strmBytes);
             String log = strmDataType.readUTF();
             String pass = strmDataType.readUTF();
             String counter = strmDataType.readUTF();
             return(new Login(log,pass,counter));
          }
          return null;
  
          }
          catch(Exception e)
          {
              System.out.println("Im from model Login loadRecord"+e);
              return null;
          }    
  
      }
  
  }
  </code></pre>
  
  <p>-----------------------LoginSrv code ---------------------------------------</p>
  
  <pre><code>   /*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  
  package model;
  
  import com.sun.lwuit.Dialog;
  import controller.AppConstants;
  import java.io.ByteArrayInputStream;
  import java.io.ByteArrayOutputStream;
  import java.io.DataInputStream;
  import java.io.DataOutputStream;
  
  /**
   *
   * @author sandipp
   */
  public class LoginSrv {
      private ServCon srv;
      public static String st1,st2,log,pas;
      public static int it1;
  
      public LoginSrv(String s1, String s2)
      {
          log = s1;
          pas = s2;
          it1=0;
          try
          {
             ByteArrayOutputStream baosdata = new ByteArrayOutputStream();
             DataOutputStream daosdata = new DataOutputStream(baosdata);
  
             daosdata.writeUTF(s1);
             daosdata.writeUTF(s2);
             srv = new  ServCon(new AppConstants().str1,null,baosdata.toByteArray(),false,false,null);
             ByteArrayOutputStream obj = (ByteArrayOutputStream)srv.startTransfer();
             byte[] record = obj.toByteArray();
             ByteArrayInputStream instr = new ByteArrayInputStream(record);
             DataInputStream indat = new DataInputStream(instr);
  
              if(srv.getRc() == 200)
              {
                  String su = indat.readUTF();
                  if(su.equals("successfull"))
                  {
                   st1 =indat.readUTF();
                   st2 =indat.readUTF();
                  }
                  else
                  {
                   Dialog.show("Error",su , null,Dialog.TYPE_INFO,null,5000);
  
                  }
              }
              else
              {
                  Dialog.show("Error",srv.getRc() + " " + srv.getRm(), null,Dialog.TYPE_INFO,null,5000);
  
              }
          }
          catch(Exception e)
          {
              System.out.println("Im from LoginSrv constructor:"+e);
          }
  
      }
  
  }
  </code></pre>