title: how to insert a record into mysql(jdbc) in java using rmi?
body: <p>I am making a project in Java using swings,JDBC and I want to use RMI to insert records into my MySQL database. Everything is working fine until I use RMI.</p>
  
  <p>When I use RMI everything works but my database table doesn't reflect a new entry being made.</p>
  
  <p>How can this be done?</p>
  
  <p>here is my remote implementation code</p>
  
  <pre><code>    package server;
  
  import java.rmi.*;
  import java.rmi.registry.LocateRegistry;
  import java.rmi.registry.*;
  import java.rmi.server.UnicastRemoteObject;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.PreparedStatement;
  
  public class myremote_imp extends UnicastRemoteObject implements myremote{
  
      String URL="jdbc:mysql://localhost:3306/project";
      String user="root";
      String pass="root";
  
      public myremote_imp()throws RemoteException
      {}
  
      public void putdata(String s6,String s7,String s8,String s1,String s2,String s3,String s4,String s5,String User,String Pass,String P_name,String P_price)
      {
          try{
  
              Class.forName("com.mysql.jdbc.Driver");
              Connection C=DriverManager.getConnection(URL,user,pass);
              System.out.println("connection Established");
              PreparedStatement S=C.prepareStatement("insert into customers values(?,?,?,?,?,?,?,?,?,?,?,?)");
              S.setString(1,s6);
              S.setString(2,s7);
              S.setString(3,s8); 
              S.setString(4,s1);
              S.setString(5,s2);
              S.setString(6,s3);
              S.setString(7,s4);
              S.setString(8,s5);
              S.setString(9,User);
              S.setString(10,Pass);
              S.setString(11,P_name);
              S.setString(12,P_price);
              //System.out.println(s6+s7+s8+s1+s2+s3+s4);just to check if values are being passed by the remote correctly which is true
          }
          catch(Exception E)
          {
              System.out.println(E);
          }
  
      }
      public static void main(String[] Args) throws RemoteException
      {
          try
          {
              Registry Rg = LocateRegistry.createRegistry(6199);
              myremote mr = new myremote_imp();
              Rg.rebind("remotedata",mr);
  
          }
          catch(Exception E)
          {
              System.out.println(E);
          }
      }
  
  }
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>connection is establised
  </code></pre>
  
  <p>but changes are not reflected in the database.</p>