hi, there are 2 different database 1 database have the list of all the users
and another DB only have the details of users who are logged in which is production DB.

i have writthen below code but i am stuck over here plese do the needful.

/**
 * 
 */
package com.kotak.autoblocknb.transaction;

import java.lang.reflect.Array;
import java.sql.SQLException;
import java.util.ArrayList;

import com.kotak.autoblocknb.test.db2.TestDB2Connect;
import com.kotak.autoblocknb.test.oracle.TestOracleConnection;

/**
 * @author swati.jha
 *
 */
public class Transaction {

    /**
     * @param args
     * @throws SQLException 
     */
    public static void main(String[] args) throws SQLException {
        // TODO Auto-generated method stub

        TestDB2Connect testDB2Connect=new TestDB2Connect();
        TestOracleConnection testOracleConnection=new TestOracleConnection();

        ArrayList db2Crns=new ArrayList();      
        ArrayList oracleCrns=new ArrayList();
        ArrayList leftOverCrns=new ArrayList();
        db2Crns=testDB2Connect.getDb2LoggedInCrns();
        oracleCrns=testOracleConnection.getDataFromPartyAuditInfo();

        int array1Size = db2Crns.size();  
        int array2Size = oracleCrns.size();
        System.out.println(db2Crns.size());
        System.out.println(oracleCrns.size());


        for(int i=0;i<oracleCrns.size();i++)
        {   
            String val=oracleCrns.get(i).toString();
            int k=0;

            for(int j=0;j<db2Crns.size();j++)
            {

                if(oracleCrns.get(i)==(db2Crns.get(j)))
                {
                        k++;        
                }   
            }

            leftOverCrns.add(val+k);

        }
        System.out.println(leftOverCrns.size());

       for(int x=0;x<leftOverCrns.size();x++)
        {
            System.out.println(leftOverCrns.get(x));
        }
      }
}

this is little bit easy...

i don't know why u following two database..may be you said DB instead of Table..

u just update user logged in date ...

that is you should have column in table like DATE_LOGGED_IN_LAST...

THEN your table has details of logging with recent activity date..

after then you just pass query as select user_name from logg_table where DATE_LOGGED_IN_LAST < date_six_month_back or DATE_LOGGED_IN_LAST NOT BETWEEN today AND date_six_month_back;

so far i thought this is your requirements...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.