Erro na hora de gravar no banco via J2ME

Bom dia pessoal… to com um exemplo aqui de como inserir no banco via j2me com PHP so que na hora que ele vai enviar os dados por parametros ele retorna um erro alguem sabe me dizer o que é???

segue aqui a pagina em php que esta funcionando perfeitamente[code]<?php

$id = $_GET[“cod”];
$nome = $_GET[“nome”];
$preco = $_GET[“preco”];
$qtd = $_GET[“qtd”];

//echo “Hello!”;
if (isset($id)) {
$con = pg_connect(“host=localhost port=5432 dbname=postgres user=postgres password=postdba”);

if ($con) {
$sql = “insert into produto2 values($id,’$nome’,$preco,$qtd)”;
$res = pg_query($con,$sql);
if ($res) {

   echo "Dados gravados com sucesso!";

 } else {
   echo "\n\nErro2";
   echo "\n\n $sql";
 }

} else {
echo “\n\nErro1”;
}
} else {
echo “\n\nErro3”;
}
pg_close($con);

?>[/code]

e aqui vai a midlet

que naum acho o pq do erro[code]/*

  • To change this template, choose Tools | Templates
  • and open the template in the editor.
    */

import javax.microedition.midlet.;
import javax.microedition.lcdui.
;
import javax.microedition.rms.RecordStore;
import java.io.InputStream;
import java.io.OutputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
import javax.microedition.rms.RecordEnumeration;

/**

  • @author Alexandre
    */
    public class VisualMIDlet extends MIDlet implements CommandListener {

    private boolean midletPaused = false;
    private RecordStore regNome = null;
    private RecordStore regPreco = null;
    private RecordStore regQtd = null;

    ////GEN-BEGIN:|fields|0|
    private Form form1;
    private TextField textFieldNome;
    private TextField textFieldPreco;
    private StringItem stringItemSaida;
    private TextField textFieldQtd;
    private TextField textFieldCod;
    private Command okCommand1;
    private Command exitCommandSair;
    private Command exitCommand2;
    private Command backCommand1;
    private Command okCommandListarRMS;
    private Command okCommandGravarRMS;
    private Command okCommandExcluirRMS;
    private Command okCommandListarBD;
    private Command okCommandGravarBD;
    private Command okCommandSincDown;
    private Command okCommandSincUP;
    ////GEN-END:|fields|0|

    /**

    • The VisualMIDlet constructor.
      */
      public VisualMIDlet() {
      }

    ////GEN-BEGIN:|methods|0|
    ////GEN-END:|methods|0|

    ////GEN-BEGIN:|0-initialize|0|0-preInitialize
    /**

    • Initilizes the application.
    • It is called only once when the MIDlet is started. The method is called before the startMIDlet method.
      */
      private void initialize() {//GEN-END:|0-initialize|0|0-preInitialize
      // write pre-initialize user code here
      //GEN-LINE:|0-initialize|1|0-postInitialize
      // write post-initialize user code here
      }//GEN-BEGIN:|0-initialize|2|
      ////GEN-END:|0-initialize|2|

    ////GEN-BEGIN:|3-startMIDlet|0|3-preAction
    /**

    • Performs an action assigned to the Mobile Device - MIDlet Started point.
      */
      public void startMIDlet() {//GEN-END:|3-startMIDlet|0|3-preAction
      // write pre-action user code here
      switchDisplayable(null, getForm1());//GEN-LINE:|3-startMIDlet|1|3-postAction
      // write post-action user code here
      }//GEN-BEGIN:|3-startMIDlet|2|
      ////GEN-END:|3-startMIDlet|2|

    ////GEN-BEGIN:|4-resumeMIDlet|0|4-preAction
    /**

    • Performs an action assigned to the Mobile Device - MIDlet Resumed point.
      */
      public void resumeMIDlet() {//GEN-END:|4-resumeMIDlet|0|4-preAction
      // write pre-action user code here
      //GEN-LINE:|4-resumeMIDlet|1|4-postAction
      // write post-action user code here
      }//GEN-BEGIN:|4-resumeMIDlet|2|
      ////GEN-END:|4-resumeMIDlet|2|

    ////GEN-BEGIN:|5-switchDisplayable|0|5-preSwitch
    /**

    • Switches a current displayable in a display. The display instance is taken from getDisplay method. This method is used by all actions in the design for switching displayable.
    • @param alert the Alert which is temporarily set to the display; if null, then nextDisplayable is set immediately
    • @param nextDisplayable the Displayable to be set
      */
      public void switchDisplayable(Alert alert, Displayable nextDisplayable) {//GEN-END:|5-switchDisplayable|0|5-preSwitch
      // write pre-switch user code here
      Display display = getDisplay();//GEN-BEGIN:|5-switchDisplayable|1|5-postSwitch
      if (alert == null) {
      display.setCurrent(nextDisplayable);
      } else {
      display.setCurrent(alert, nextDisplayable);
      }//GEN-END:|5-switchDisplayable|1|5-postSwitch
      // write post-switch user code here
      }//GEN-BEGIN:|5-switchDisplayable|2|
      ////GEN-END:|5-switchDisplayable|2|

    ////GEN-BEGIN:|7-commandAction|0|7-preCommandAction
    /**

    • Called by a system to indicated that a command has been invoked on a particular displayable.

    • @param command the Command that was invoked

    • @param displayable the Displayable where the command was invoked
      */
      public void commandAction(Command command, Displayable displayable) {//GEN-END:|7-commandAction|0|7-preCommandAction
      // write pre-action user code here
      if (displayable == form1) {//GEN-BEGIN:|7-commandAction|1|19-preAction
      if (command == exitCommandSair) {//GEN-END:|7-commandAction|1|19-preAction
      // write pre-action user code here
      exitMIDlet();//GEN-LINE:|7-commandAction|2|19-postAction
      // write post-action user code here
      } else if (command == okCommandExcluirRMS) {//GEN-LINE:|7-commandAction|3|43-preAction
      // write pre-action user code here
      //GEN-LINE:|7-commandAction|4|43-postAction
      try {
      regNome = RecordStore.openRecordStore(“prod_nome”, true);
      regPreco = RecordStore.openRecordStore(“prod_preco”, true);
      regQtd = RecordStore.openRecordStore(“prod_qtd”, true);

              int i;
              i = Integer.parseInt(textFieldCod.getString());
              regNome.deleteRecord(i);
              regPreco.deleteRecord(i);
              regQtd.deleteRecord(i);
              
              regNome.closeRecordStore();
              regPreco.closeRecordStore();
              regQtd.closeRecordStore();
              
              stringItemSaida.setText("\nRegistro excluído com sucesso!!");
              textFieldCod.setString("");
              
           } catch (Exception e) {
              stringItemSaida.setText("\nErro ao excluir registro!");
           }
           // write post-action user code here
       } else if (command == okCommandGravarBD) {//GEN-LINE:|7-commandAction|5|45-preAction
           // write pre-action user code here
      

//GEN-LINE:|7-commandAction|6|45-postAction
// write post-action user code here
String pCod, pNome, pPreco, pQtd;
pCod = textFieldCod.getString();
pNome = textFieldNome.getString();
pPreco = textFieldPreco.getString();
pQtd = textFieldQtd.getString();

            Conexao obConexao;
            obConexao = new Conexao(1);
            
            obConexao.Inserir(pCod, pNome, pPreco, pQtd);
            
                    
        } else if (command == okCommandGravarRMS) {//GEN-LINE:|7-commandAction|7|34-preAction
            // write pre-action user code here

//GEN-LINE:|7-commandAction|8|34-postAction
// write post-action user code here
GravarRMS(textFieldCod.getString(), textFieldNome.getString(),
textFieldPreco.getString(), textFieldQtd.getString());

        } else if (command == okCommandListarBD) {//GEN-LINE:|7-commandAction|9|47-preAction
            // write pre-action user code here

//GEN-LINE:|7-commandAction|10|47-postAction
// write post-action user code here
Conexao obConexao;
obConexao = new Conexao(1);
obConexao.Listar(“listar.php”);

        } else if (command == okCommandListarRMS) {//GEN-LINE:|7-commandAction|11|36-preAction
            // write pre-action user code here

//GEN-LINE:|7-commandAction|12|36-postAction
// write post-action user code here

            try {
               regNome = RecordStore.openRecordStore("prod_nome", false);
               regPreco = RecordStore.openRecordStore("prod_preco", false);
               regQtd = RecordStore.openRecordStore("prod_qtd", false);
               
               byte[] aux2 = new byte[1];
               int i, len;
               String auxS;
               
               auxS = "";
               RecordEnumeration re= regNome.enumerateRecords(null,null,false);
               //re.hasNextElement()
               //for (i=1;i<=regNome.getNumRecords();i++) {
               //i = 1;
               while (re.hasNextElement()) {        
                  i = re.nextRecordId(); 
                  if (regNome.getRecordSize(i)>aux2.length) {
                     aux2 = new byte[regNome.getRecordSize(i)];
                  }
                  len = regNome.getRecord(i, aux2, 0);
                  auxS = auxS + "\n" + new String(aux2,0,len);
                  
                  if (regPreco.getRecordSize(i)>aux2.length) {
                     aux2 = new byte[regPreco.getRecordSize(i)];
                  }
                  len = regPreco.getRecord(i, aux2, 0);
                  auxS = auxS + " " + new String(aux2,0,len);
                  
                  if (regQtd.getRecordSize(i)>aux2.length) {
                     aux2 = new byte[regQtd.getRecordSize(i)];
                  }
                  len = regQtd.getRecord(i, aux2, 0);
                  auxS = auxS + " " + new String(aux2,0,len);
               }
               auxS = auxS + "\n" + String.valueOf(regNome.getNumRecords()) 
                              + " registro(s) encontrado(s)";
               
               
               stringItemSaida.setText(auxS);

               regNome.closeRecordStore();
               regPreco.closeRecordStore();
               regQtd.closeRecordStore();
            } catch (Exception e) {
               //textField2.setString("Erro de leitura");
                stringItemSaida.setText("\nNenhum registro encontrado!");
            }
        } else if (command == okCommandSincDown) {//GEN-LINE:|7-commandAction|13|51-preAction
            // write pre-action user code here

//GEN-LINE:|7-commandAction|14|51-postAction
// write post-action user code here
//String Aux1, Aux2;
//Aux1 = textFieldNome.getString();

            //Aux2 = Aux1.substring(0, Aux1.indexOf(";"));
            
            //stringItemSaida.setText(Aux2);
            
            //Aux1 = Aux1.substring(Aux1.indexOf(";")+1);
            //textFieldNome.setString(Aux1);
            
            try {                   
               Conexao obConexao;
               obConexao = new Conexao(1);
               obConexao.Listar("listarSinc.php"); 
            } catch (Exception e) {
               stringItemSaida.setText("\nOps!!");                     
            }                
            
        } else if (command == okCommandSincUP) {//GEN-LINE:|7-commandAction|15|49-preAction
            // write pre-action user code here

//GEN-LINE:|7-commandAction|16|49-postAction
// write post-action user code here
try {
regNome = RecordStore.openRecordStore(“prod_nome”, false);
regPreco = RecordStore.openRecordStore(“prod_preco”, false);
regQtd = RecordStore.openRecordStore(“prod_qtd”, false);

               byte[] aux2 = new byte[1];
               int i, len;
               String pCod, pNome, pPreco, pQtd;
               
               //auxS = "";
               for (i=1;i<=regNome.getNumRecords();i++) {
                  if (regNome.getRecordSize(i)>aux2.length) {
                     aux2 = new byte[regNome.getRecordSize(i)];
                  }
                  len = regNome.getRecord(i, aux2, 0);
                  pNome = new String(aux2,0,len);
                  
                  if (regPreco.getRecordSize(i)>aux2.length) {
                     aux2 = new byte[regPreco.getRecordSize(i)];
                  }
                  len = regPreco.getRecord(i, aux2, 0);
                  pPreco = new String(aux2,0,len);
                  
                  if (regQtd.getRecordSize(i)>aux2.length) {
                     aux2 = new byte[regQtd.getRecordSize(i)];
                  }
                  len = regQtd.getRecord(i, aux2, 0);
                  pQtd = new String(aux2,0,len);
                  
                  pCod = "1";
                  
                  
                  Conexao obConexao;
                  System.out.print("Inicio..." + String.valueOf(i));
                  System.out.print("\n");
                  obConexao = new Conexao(i);
                  obConexao.Inserir(pCod, pNome, pPreco, pQtd);
                  System.out.print("Fim..." + String.valueOf(i));
                  System.out.print("\n");
                  
               }
               //auxS = auxS + "\n" + String.valueOf(regNome.getNumRecords()) 
                 //             + " registro(s) encontrado(s)";
               
               
               //stringItemSaida.setText(auxS);

               regNome.closeRecordStore();
               regPreco.closeRecordStore();
               regQtd.closeRecordStore();
            } catch (Exception e) {
               //textField2.setString("Erro de leitura");
                stringItemSaida.setText("\nNenhum registro encontrado!'");
            }
            
        }//GEN-BEGIN:|7-commandAction|17|7-postCommandAction
    }//GEN-END:|7-commandAction|17|7-postCommandAction
    // write post-action user code here
}//GEN-BEGIN:|7-commandAction|18|
//</editor-fold>//GEN-END:|7-commandAction|18|


//<editor-fold defaultstate="collapsed" desc=" Generated Getter: form1 ">//GEN-BEGIN:|14-getter|0|14-preInit
/**
 * Returns an initiliazed instance of form1 component.
 * @return the initialized component instance
 */
public Form getForm1() {
    if (form1 == null) {//GEN-END:|14-getter|0|14-preInit
        // write pre-init user code here
        form1 = new Form("Cadastro de Produtos", new Item[] { getTextFieldCod(), getTextFieldNome(), getTextFieldPreco(), getTextFieldQtd(), getStringItemSaida() });//GEN-BEGIN:|14-getter|1|14-postInit
        form1.addCommand(getOkCommandGravarRMS());
        form1.addCommand(getOkCommandGravarBD());
        form1.addCommand(getOkCommandListarRMS());
        form1.addCommand(getOkCommandListarBD());
        form1.addCommand(getOkCommandSincUP());
        form1.addCommand(getOkCommandSincDown());
        form1.addCommand(getOkCommandExcluirRMS());
        form1.addCommand(getExitCommandSair());
        form1.setCommandListener(this);//GEN-END:|14-getter|1|14-postInit
        // write post-init user code here
    }//GEN-BEGIN:|14-getter|2|
    return form1;
}
//</editor-fold>//GEN-END:|14-getter|2|



//<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand1 ">//GEN-BEGIN:|16-getter|0|16-preInit
/**
 * Returns an initiliazed instance of okCommand1 component.
 * @return the initialized component instance
 */
public Command getOkCommand1() {
    if (okCommand1 == null) {//GEN-END:|16-getter|0|16-preInit
        // write pre-init user code here
        okCommand1 = new Command("Ok", Command.OK, 0);//GEN-LINE:|16-getter|1|16-postInit
        // write post-init user code here
    }//GEN-BEGIN:|16-getter|2|
    return okCommand1;
}
//</editor-fold>//GEN-END:|16-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommandSair ">//GEN-BEGIN:|18-getter|0|18-preInit
/**
 * Returns an initiliazed instance of exitCommandSair component.
 * @return the initialized component instance
 */
public Command getExitCommandSair() {
    if (exitCommandSair == null) {//GEN-END:|18-getter|0|18-preInit
        // write pre-init user code here
        exitCommandSair = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|18-getter|1|18-postInit
        // write post-init user code here
    }//GEN-BEGIN:|18-getter|2|
    return exitCommandSair;
}
//</editor-fold>//GEN-END:|18-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand2 ">//GEN-BEGIN:|20-getter|0|20-preInit
/**
 * Returns an initiliazed instance of exitCommand2 component.
 * @return the initialized component instance
 */
public Command getExitCommand2() {
    if (exitCommand2 == null) {//GEN-END:|20-getter|0|20-preInit
        // write pre-init user code here
        exitCommand2 = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|20-getter|1|20-postInit
        // write post-init user code here
    }//GEN-BEGIN:|20-getter|2|
    return exitCommand2;
}
//</editor-fold>//GEN-END:|20-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand1 ">//GEN-BEGIN:|22-getter|0|22-preInit
/**
 * Returns an initiliazed instance of backCommand1 component.
 * @return the initialized component instance
 */
public Command getBackCommand1() {
    if (backCommand1 == null) {//GEN-END:|22-getter|0|22-preInit
        // write pre-init user code here
        backCommand1 = new Command("Back", Command.BACK, 0);//GEN-LINE:|22-getter|1|22-postInit
        // write post-init user code here
    }//GEN-BEGIN:|22-getter|2|
    return backCommand1;
}
//</editor-fold>//GEN-END:|22-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldNome ">//GEN-BEGIN:|29-getter|0|29-preInit
/**
 * Returns an initiliazed instance of textFieldNome component.
 * @return the initialized component instance
 */
public TextField getTextFieldNome() {
    if (textFieldNome == null) {//GEN-END:|29-getter|0|29-preInit
        // write pre-init user code here
        textFieldNome = new TextField("Nome", null, 32, TextField.ANY);//GEN-LINE:|29-getter|1|29-postInit
        // write post-init user code here
    }//GEN-BEGIN:|29-getter|2|
    return textFieldNome;
}
//</editor-fold>//GEN-END:|29-getter|2|



//<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldPreco ">//GEN-BEGIN:|31-getter|0|31-preInit
/**
 * Returns an initiliazed instance of textFieldPreco component.
 * @return the initialized component instance
 */
public TextField getTextFieldPreco() {
    if (textFieldPreco == null) {//GEN-END:|31-getter|0|31-preInit
        // write pre-init user code here
        textFieldPreco = new TextField("Pre\u00E7o", null, 32, TextField.DECIMAL);//GEN-LINE:|31-getter|1|31-postInit
        // write post-init user code here
    }//GEN-BEGIN:|31-getter|2|
    return textFieldPreco;
}
//</editor-fold>//GEN-END:|31-getter|2|



//<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommandGravarRMS ">//GEN-BEGIN:|33-getter|0|33-preInit
/**
 * Returns an initiliazed instance of okCommandGravarRMS component.
 * @return the initialized component instance
 */
public Command getOkCommandGravarRMS() {
    if (okCommandGravarRMS == null) {//GEN-END:|33-getter|0|33-preInit
        // write pre-init user code here
        okCommandGravarRMS = new Command("Gravar RMS", Command.OK, 0);//GEN-LINE:|33-getter|1|33-postInit
        // write post-init user code here
    }//GEN-BEGIN:|33-getter|2|
    return okCommandGravarRMS;
}
//</editor-fold>//GEN-END:|33-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommandListarRMS ">//GEN-BEGIN:|35-getter|0|35-preInit
/**
 * Returns an initiliazed instance of okCommandListarRMS component.
 * @return the initialized component instance
 */
public Command getOkCommandListarRMS() {
    if (okCommandListarRMS == null) {//GEN-END:|35-getter|0|35-preInit
        // write pre-init user code here
        okCommandListarRMS = new Command("Listar RMS", Command.OK, 0);//GEN-LINE:|35-getter|1|35-postInit
        // write post-init user code here
    }//GEN-BEGIN:|35-getter|2|
    return okCommandListarRMS;
}
//</editor-fold>//GEN-END:|35-getter|2|





//<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItemSaida ">//GEN-BEGIN:|39-getter|0|39-preInit
/**
 * Returns an initiliazed instance of stringItemSaida component.
 * @return the initialized component instance
 */
public StringItem getStringItemSaida() {
    if (stringItemSaida == null) {//GEN-END:|39-getter|0|39-preInit
        // write pre-init user code here
        stringItemSaida = new StringItem("Retorno", null);//GEN-LINE:|39-getter|1|39-postInit
        // write post-init user code here
    }//GEN-BEGIN:|39-getter|2|
    return stringItemSaida;
}
//</editor-fold>//GEN-END:|39-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldQtd ">//GEN-BEGIN:|40-getter|0|40-preInit
/**
 * Returns an initiliazed instance of textFieldQtd component.
 * @return the initialized component instance
 */
public TextField getTextFieldQtd() {
    if (textFieldQtd == null) {//GEN-END:|40-getter|0|40-preInit
        // write pre-init user code here
        textFieldQtd = new TextField("Quantidade", null, 32, TextField.NUMERIC);//GEN-LINE:|40-getter|1|40-postInit
        // write post-init user code here
    }//GEN-BEGIN:|40-getter|2|
    return textFieldQtd;
}
//</editor-fold>//GEN-END:|40-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldCod ">//GEN-BEGIN:|41-getter|0|41-preInit
/**
 * Returns an initiliazed instance of textFieldCod component.
 * @return the initialized component instance
 */
public TextField getTextFieldCod() {
    if (textFieldCod == null) {//GEN-END:|41-getter|0|41-preInit
        // write pre-init user code here
        textFieldCod = new TextField("C\u00F3digo", null, 32, TextField.NUMERIC);//GEN-LINE:|41-getter|1|41-postInit
        // write post-init user code here
    }//GEN-BEGIN:|41-getter|2|
    return textFieldCod;
}
//</editor-fold>//GEN-END:|41-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommandExcluirRMS ">//GEN-BEGIN:|42-getter|0|42-preInit
/**
 * Returns an initiliazed instance of okCommandExcluirRMS component.
 * @return the initialized component instance
 */
public Command getOkCommandExcluirRMS() {
    if (okCommandExcluirRMS == null) {//GEN-END:|42-getter|0|42-preInit
        // write pre-init user code here
        okCommandExcluirRMS = new Command("Excluir RMS", Command.OK, 0);//GEN-LINE:|42-getter|1|42-postInit
        // write post-init user code here
    }//GEN-BEGIN:|42-getter|2|
    return okCommandExcluirRMS;
}
//</editor-fold>//GEN-END:|42-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommandGravarBD ">//GEN-BEGIN:|44-getter|0|44-preInit
/**
 * Returns an initiliazed instance of okCommandGravarBD component.
 * @return the initialized component instance
 */
public Command getOkCommandGravarBD() {
    if (okCommandGravarBD == null) {//GEN-END:|44-getter|0|44-preInit
        // write pre-init user code here
        okCommandGravarBD = new Command("Gravar BD", Command.OK, 0);//GEN-LINE:|44-getter|1|44-postInit
        // write post-init user code here
    }//GEN-BEGIN:|44-getter|2|
    return okCommandGravarBD;
}
//</editor-fold>//GEN-END:|44-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommandListarBD ">//GEN-BEGIN:|46-getter|0|46-preInit
/**
 * Returns an initiliazed instance of okCommandListarBD component.
 * @return the initialized component instance
 */
public Command getOkCommandListarBD() {
    if (okCommandListarBD == null) {//GEN-END:|46-getter|0|46-preInit
        // write pre-init user code here
        okCommandListarBD = new Command("Listar BD", Command.OK, 0);//GEN-LINE:|46-getter|1|46-postInit
        // write post-init user code here
    }//GEN-BEGIN:|46-getter|2|
    return okCommandListarBD;
}
//</editor-fold>//GEN-END:|46-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommandSincUP ">//GEN-BEGIN:|48-getter|0|48-preInit
/**
 * Returns an initiliazed instance of okCommandSincUP component.
 * @return the initialized component instance
 */
public Command getOkCommandSincUP() {
    if (okCommandSincUP == null) {//GEN-END:|48-getter|0|48-preInit
        // write pre-init user code here
        okCommandSincUP = new Command("Sincroniza\u00E7\u00E3o UP", Command.OK, 0);//GEN-LINE:|48-getter|1|48-postInit
        // write post-init user code here
    }//GEN-BEGIN:|48-getter|2|
    return okCommandSincUP;
}
//</editor-fold>//GEN-END:|48-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommandSincDown ">//GEN-BEGIN:|50-getter|0|50-preInit
/**
 * Returns an initiliazed instance of okCommandSincDown component.
 * @return the initialized component instance
 */
public Command getOkCommandSincDown() {
    if (okCommandSincDown == null) {//GEN-END:|50-getter|0|50-preInit
        // write pre-init user code here
        okCommandSincDown = new Command("Sincroniza\u00E7\u00E3o Down", Command.OK, 0);//GEN-LINE:|50-getter|1|50-postInit
        // write post-init user code here
    }//GEN-BEGIN:|50-getter|2|
    return okCommandSincDown;
}
//</editor-fold>//GEN-END:|50-getter|2|







/**
 * Returns a display instance.
 * @return the display instance.
 */
public Display getDisplay () {
    return Display.getDisplay(this);
}

/**
 * Exits MIDlet.
 */
public void exitMIDlet() {
    switchDisplayable (null, null);
    destroyApp(true);
    notifyDestroyed();
}

/**
 * Called when MIDlet is started.
 * Checks whether the MIDlet have been already started and initialize/starts or resumes the MIDlet.
 */
public void startApp() {
    if (midletPaused) {
        resumeMIDlet ();
    } else {
        initialize ();
        startMIDlet ();
    }
    midletPaused = false;
}

/**
 * Called when MIDlet is paused.
 */
public void pauseApp() {
    midletPaused = true;
}

/**
 * Called to signal the MIDlet to terminate.
 * @param unconditional if true, then the MIDlet has to be unconditionally terminated and all resources has to be released.
 */
public void destroyApp(boolean unconditional) {
}

public class Conexao extends Form implements Runnable {
    Thread obThread;
    String url;
    int i;
    boolean Sinc;
    
    public Conexao(int p) {            
        super("");
        i = p;
        System.out.print("Contruiu..." + String.valueOf(i));
        //obThread = new Thread(this);
        //obThread.start();
    }
    
    public void Inserir(String pCod, String pNome, String pPreco
            , String pQtd) {
        url = "http://localhost/gravar.php?cod=" +
                 pCod + "&nome=" +
                 pNome + "&preco=" +
                 pPreco + "&qtd=" +
                 pQtd;
        obThread = new Thread(this);
        System.out.print("Thread..." + String.valueOf(i));
        System.out.print("\n");
        obThread.start();
        
    }
    
    public void Listar(String pLink) {
        if (pLink == "listarSinc.php") {
           Sinc = true;                 
        } else {
           Sinc = false;                
        }
        url = "http://localhost/" + pLink;                        
        obThread = new Thread(this);
        obThread.start();
        
    }
    
    
    
    public void run() {
        try {
           HttpConnection con;
                         
           con = (HttpConnection) Connector.open(url,
                   Connector.READ_WRITE);
           System.out.print("Conectou..." + String.valueOf(i));
           System.out.print("\n");
           
           InputStream in;
           int len;
           byte[] data;
           data = new byte[5000];
           in = con.openInputStream();               
           len = in.read(data);                              
                          
           String auxString;
           auxString = new String(data,0,len);
           if (Sinc) {
              InserirSinc(auxString);  
            } else {
              stringItemSaida.setText("\n" + auxString);
            }
           
           System.out.print("Enviou..." + String.valueOf(i));
           System.out.print("\n");
           //stringItemSaida.setText("\n" + new String(data,0,len));
           
           con.close();
        } catch(Exception e) {
           stringItemSaida.setText("Erro"); 
            
        }
    }
}

public void InserirSinc(String pDados) {
  String aux, pCod, pNome, pPreco, pQtd;
  int i;
  //aux1 = pDados;
  i = 0;
  try { 
   while (pDados.length() > 4) {   
     pCod = pDados.substring(0, pDados.indexOf(";"));                            
     pDados = pDados.substring(pDados.indexOf(";")+1);
  
     pNome = pDados.substring(0, pDados.indexOf(";"));                      
     pDados = pDados.substring(pDados.indexOf(";")+1);
  
     pPreco = pDados.substring(0, pDados.indexOf(";"));                      
     pDados = pDados.substring(pDados.indexOf(";")+1);
  
     pQtd = pDados.substring(0, pDados.indexOf(";"));                      
     pDados = pDados.substring(pDados.indexOf(";")+1);
  
     GravarRMS(pCod, pNome, pPreco, pQtd);
     i++;
   }  
     stringItemSaida.setText("\n Sincronização realizada com sucesso!"+
                             String.valueOf(i) + " registro(s) inserido(s)");            
  } catch (Exception e) {
     stringItemSaida.setText("\n Ops!");             
  }   
  //stringItemSaida.setText(pDados);            
}

public void GravarRMS(String pCod, String pNome, String pPreco, String pQtd) {
            try {
               regNome = RecordStore.openRecordStore("prod_nome", true);
               regPreco = RecordStore.openRecordStore("prod_preco", true);
               regQtd = RecordStore.openRecordStore("prod_qtd", true);
               
               String auxS;
               byte[] auxB;
               
               auxS = pNome;
               auxB = auxS.getBytes();
               regNome.addRecord(auxB, 0, auxB.length);
               
               auxS = pPreco;
               auxB = auxS.getBytes();
               regPreco.addRecord(auxB, 0, auxB.length);
               
               auxS = pQtd;
               auxB = auxS.getBytes();
               regQtd.addRecord(auxB, 0, auxB.length);
               
               //regQtd.
               
               regNome.closeRecordStore();
               regPreco.closeRecordStore();
               regQtd.closeRecordStore();
               
               stringItemSaida.setText("\nCadastro realizado com sucesso!!");
               textFieldNome.setString("");
               textFieldPreco.setString("");
               textFieldQtd.setString("");
            } catch (Exception e) {
               stringItemSaida.setText("\nErro ao cadastrar!");
            } 
}

}
[/code] c alguem puder ajudar …

vlw ae pessoal

sera que alguem poderia testar para mim esta midlet???

vlwwww

Cara, desculpa so estar respondendo o topico agora, nao olhei o codigo direito mais pelo que voce quer fazer, por que vc simplesmente so nao chama a pagina em PHP, chama ela passando os parametros que voce quer e pronto …

Ja tentou dessa forma?