3 Replies Latest reply: Apr 5, 2013 10:51 AM by TPD-Opitz RSS

    java error

    998409
      import java.io.*;
      import java.sql.*;

      class b1
      {
      static int s1,s3,s11,s14,s16;
      static String s2,s4,s5,s6,s7,s8,s9,s10,s12,s13,s15;


      public static void main(String args[]) throws IOException
      {
      try
      {
      DataInputStream in = new DataInputStream(System.in);
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

      Connection con=DriverManager.getConnection

      ("jdbc:odbc:DB1","oltpmgr","Welcome1");
      PreparedStatement pt=con.prepareStatement("select customers.customer_id,

      customers.customer_name, customers.customer_credit_limit,

      customers.customer_currency_code, customers.customer_last_purchase_date,

      addresses.bill_to_address1, addresses.bill_to_address2, addresses.bill_to_city,

      addresses.bill_to_state, addresses.bill_to_country, addresses.bill_to_pincode,

      customer_contacts.bill_to_contact_first_name,

      customer_contacts.bill_to_contact_last_name,

      customer_contacts.bill_to_contact_phone,

      customer_contacts.bill_to_contact_email, customer_contacts.bill_to_contact_fax

      from customers, addresses, customer_contacts where customers.customer_id

      =addresses.customer_id and addresses.address_id =

      customer_contacts.address_id");

      //System.out.println("Enter AGE:");
      //System.out.println("Enter COUNTRY:");

      /*pt.setInt(1,Integer.parseInt(in.readLine()));
      pt.setString(2,in.readLine());
      pt.setInt(3,Integer.parseInt(in.readLine()));
      pt.setString(4,in.readLine());
      pt.setString(5,in.readLine());
      pt.setString(6,in.readLine());
      pt.setString(7,in.readLine());
      pt.setString(8,in.readLine());
      pt.setString(9,in.readLine());
      pt.setString(10,in.readLine());
      pt.setInt(11,Integer.parseInt(in.readLine()));
      pt.setString(12,in.readLine());
      pt.setString(13,in.readLine());
      pt.setInt(14,Integer.parseInt(in.readLine()));
      pt.setString(15,in.readLine());
      pt.setInt(16,Integer.parseInt(in.readLine()));*/

      ResultSet rs=pt.executeQuery();

      //int s1,s3;

      //String s2,s4;


      Connection con1=DriverManager.getConnection("jdbc:odbc:DB2","ods","Welcome1");
      PreparedStatement pt1;



      while(rs.next())
      {
      pt1=con1.prepareStatement("insert into CUSTOMERS_ODS(customer_id, customer_name,

      customer_credit_limit, customer_currency_code, customer_last_purchase_date,

      bill_to_address1, bill_to_address2, bill_to_city, bill_to_state,

      bill_to_country, bill_to_pincode, bill_to_contact_first_name,

      bill_to_contact_last_name, bill_to_contact_phone,

      bill_to_contact_email,bill_to_contact_fax) values

      (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

      s1=Integer.parseInt(rs.getString(1));
      s2=rs.getString(2);
      s3=Integer.parseInt(rs.getString(3));
      s4=rs.getString(4);
      s5=rs.getString(5);
      s6=rs.getString(6);
      s7=rs.getString(7);
      s8=rs.getString(8);
      s9=rs.getString(9);
      s10=rs.getString(10);
      s11=Integer.parseInt(rs.getString(11));
      s12=rs.getString(12);
      s13=rs.getString(13);
      s14=Integer.parseInt(rs.getString(14));
      s15=rs.getString(15);
      s16=Integer.parseInt(rs.getString(16));

      pt1.setInt(1,s1);
      pt1.setString(2,s2);
      pt1.setInt(3,s3);
      pt1.setString(4,s4);
      pt1.setString(5,s5);
      pt1.setString(6,s6);
      pt1.setString(7,s7);
      pt1.setString(8,s8);
      pt1.setString(9,s9);
      pt1.setString(10,s10);
      pt1.setInt(11,s11);
      pt1.setString(12,s12);
      pt1.setString(13,s13);
      pt1.setInt(14,s14);
      pt1.setString(15,s15);
      pt1.setInt(16,s16);

      //if(s3==0)
      //System.out.println("Entered age not Found");


      pt1.executeUpdate();

      }

      //if(s4==null && s3==0)
      //System.out.println("Entered data not Found");
      //else
      System.out.println("Inserted Successfullly");

      }
      catch(Exception e)
      {
      }

      }
      }



      When i try to run this nothing is happening . Please help me to successfully run this program. This is for my project. Where i am extracting data from a schema called oltpmgr and transfering and loading it into another schema called ods.