This same code run good on windows 7 32 bit
Problem happen when i run it on windows 7 64 bit
error : database is locked...

public void genTablehadir() {

        tblKehadiran.setAutoCreateColumnsFromModel(false);
        m_data = new Kehadirantable(this);
        tblKehadiran.setModel(m_data);
        tblKehadiran.setRowHeight(23);
        //inisialisasi
        int m_Jalokasi=0,m_kode=0;
        Boolean m_alokasi=false;
        String[] parsePeriode;
        String  m_npk="null",m_nama="null",m_ket="null",m_id="null",m_flagE="null",m_flagP="null",m_cekhk="null",m_ceksts="null";
        try {
            db.createMasterConn();
            rs1 = db.getQueryResult("SELECT * FROM V_EMP WHERE SITE_CODE = 'TPP' AND GANGCODE ='"+getMandor()+"'ORDER BY EMPNAME ");                  
            while (rs1.next()) {
                m_npk=rs1.getString("EMPCODE");                
                m_nama=rs1.getString("EMPNAME");                
                m_id=rs1.getString("IDNO2");                
                m_cekhk=rs1.getString("CEK_HK");
                m_flagE=rs1.getString("FLAG_EMPLOYEETYPE");
                m_flagP=rs1.getString("FLAG_PAYMENTTYPE");
                db3.createMasterConn();
                //Set default kode
                rs3 = db3.getQueryResult("SELECT rowid,DESCRIPTION FROM ATTENDANCE where ATTENDANCECODE='KJ'");               
                while(rs3.next()){
                     m_kode=rs3.getInt("rowid")-1;
                     m_ket=rs3.getString("DESCRIPTION");
                }
                db3.closeConnection();
                //Cari kode dari attendance dan set periode
                db3.createMasterConn();
                rs3 = db3.getQueryResult("SELECT r.DESCRIPTION,v.PERIODE,v.ATTENCODE,r.rowid,r.ATTENDANCECODE FROM V_KALENDAR v LEFT OUTER JOIN  ATTENDANCE r ON v.ATTENCODE=r.ATTENDANCECODE  WHERE v.PT='TPP' AND v.TANGGAL= '"+getTanggal()+"'");
                String periode="00";
                while (rs3.next()){
                    if(rs3.getInt("rowid")>0){
                      m_ket=rs3.getString("DESCRIPTION");
                      m_kode=rs3.getInt("rowid")-1;

                    }
                    periode=rs3.getString("PERIODE");
                    parsePeriode = periode.split("(?<=\\G..)");
                    periode = parsePeriode[2]+"/"+parsePeriode[3]+"/"+parsePeriode[0]+parsePeriode[1];
                    periode=periode+" 00:00:00";

                }
                db3.closeConnection();
                //set ceksts
                db3.createMasterConn();
                rs2 = db3.getQueryResult("SELECT FLAG FROM V_EMP WHERE SITE_CODE = 'TPP' AND PERIODDATE = '"+periode+"' AND EMPCODE = '"+rs1.getString("EMPCODE")+"'");
                m_ceksts="0";
                while (rs2.next()){
                    if(rs2.getString("FLAG")!=null)
                    m_ceksts=rs2.getString("FLAG");

                }
                db3.closeConnection();
                //set kode jika ditemukan di ganggalocation
                db2.createPimsConn();
                rs2 = db2.getQueryResult("SELECT attendate, employeecode, attendancecode AS code FROM empattendance e WHERE site_code = 'TPP' AND e.EMPLOYEECODE = '"+rs1.getString("EMPCODE")+"' AND e.ATTENDATE = '"+getTanggal()+"'");              
                while (rs2.next()){
                    db3.createMasterConn();
                    rs3 = db3.getQueryResult("SELECT rowid,DESCRIPTION from ATTENDANCE where ATTENDANCECODE='"+rs2.getString("ATTENCODE")+"'");
                    while (rs3.next()){
                    m_kode=rs3.getInt("rowid")-1;
                    m_ket=rs3.getString("DESCRIPTION");
                    }
                    db3.closeConnection();
                }
                db2.closeConnection();
                //set jumlah alokasi
                db2.createPimsConn();
                rs2 = db2.getQueryResult("SELECT EMPCODE, TDATE, COUNT(*) FROM gangallocation WHERE SITE_CODE = 'TPP' AND EMPCODE = '"+rs1.getString("EMPCODE") +"' AND TDATE = '"+getDateAlo()+"' ");
                while (rs2.next()){
                    m_Jalokasi=rs2.getInt("COUNT(*)"); 

                }
                db2.closeConnection(); 
                m_data.setData(m_npk, m_nama, m_id, m_flagE,m_flagP,m_kode,m_ket,m_alokasi, m_Jalokasi, m_cekhk,m_ceksts); 
            }                 
            db.closeConnection();   
        } catch (Exception ex1) {
            JOptionPane.showMessageDialog(this, ex1.toString(),"TABLE KEHADIRAN",JOptionPane.INFORMATION_MESSAGE);

        }
        tblKehadiran.setModel(m_data);
        tblKehadiran.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        tblKehadiran.tableChanged(new TableModelEvent(tblKehadiran.getModel()));
        if(tabledraw)
        {
            tabledraw=false;
        for (int k = 0; k < m_data.getColumnCount(); k++) {

        TableCellRenderer renderer;
        if (k==Kehadirantable.COL_ALOKASI)
            renderer = new CheckCellRenderer();
        else {
            DefaultTableCellRenderer textRenderer = 
            new DefaultTableCellRenderer();
            renderer = textRenderer;
        }

        TableCellEditor editor;
        final TableCellEditor comm = null;
        JComboBox cmb=new JComboBox(CATEGORIES); 
        if (k==Kehadirantable.COL_KODE)
        {
            editor = new DefaultCellEditor(cmb);

        }   
        else if (k==Kehadirantable.COL_ALOKASI)
            editor = new DefaultCellEditor(new JCheckBox());
        else
            editor = new DefaultCellEditor(new JTextField());
            TableColumn column = new TableColumn(k,m_data.m_columns[k].m_width,renderer, editor);
            tblKehadiran.addColumn(column);   
        }
        }


    }

Too little information to actually help you out:

  • Which Java version?
  • Which database and what version?
  • Which database driver are you using?
  • Is it possible for you to post the exact stack trace?

java version 1.7
database sqlite
sqlitejdbc v0.56
yes of course.

After searching around a bit, it seems that there are weird issues related to SQLite JDBC working fine on 32 bit Windows but not on 64 bit. Also, noteworthy is the point that the LIB file packaged inside the sqllite JAR is compiled against 32 bit Windows.

I would suggest either trying out a different driver or making sure you don't open up two simultaneous connections which result in this exception.

ok i will try diff driver.. can u give me suggestion how to search better driver

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.