मैं एक टेक्स्ट फ़ाइल से पूर्णांक पढ़ रहा हूं, उन्हें एक क्वेरी में इनपुट के रूप में और क्वेरी आउटपुट प्राप्त करना और एक xls फ़ाइल को लिखना।अमान्य पंक्ति संख्या (65536) स्वीकार्य सीमा के बाहर (0..65535)
ResultSet rs;
Connection con = null;
PreparedStatement ps = null;
int person_org_id, external_person_org_id;
File f = null;
Scanner scan = null;
try {
System.out.println("----------checkpoint-----------");
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("----------checkpoint 1-----------");
con = DriverManager.getConnection("jdbc:oracle:thin:@ksdjf.kjdlk.jkd.com:2222:edb", "aaaaa", "aaaa");
System.out.println("----------checkpoint 2 ----------");
if (con == null) {
System.out.println("unable to connect to database");
}
System.out.println("----------checkpoint 3::connected to database---------");
StringBuffer sql = new StringBuffer();
sql.append("select abd from edb.abd where customer_id=510 and person_org_id =? ");
ps = con.prepareStatement(sql.toString());
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Excel Sheet");
HSSFRow rowhead = sheet.createRow(0);
rowhead.createCell(0).setCellValue("ABC");
rowhead.createCell(1).setCellValue("DEF");
f = new File("/tmp/contacts.txt");
scan = new Scanner(f);
int index=1;
while (scan.hasNextInt()) {
person_org_id = scan.nextInt();
ps.setInt(1,person_org_id);
rs= ps.executeQuery();
while (rs.next()) {
external_person_org_id = rs.getInt(1);
HSSFRow row = sheet.createRow(index);
row.createCell(0).setCellValue(person_org_id);
row.createCell(1).setCellValue(external_person_org_id);
index++;
}
}
FileOutputStream fileOut = new FileOutputStream(new File("/tmp/External_contact_id.xls"));
wb.write(fileOut);
fileOut.close();
System.out.println("--------checkpoint 4:: writing data to xls completed------------");
}
catch (Exception e) {
System.out.println(e.getMessage());
}
मैं त्रुटि Invalid row number (65536) outside allowable range (0..65535)
मेरे contacts.txt
फ़ाइल हो रही है चारों ओर 36000 संख्या है।
आप हमें कोड का एक बहुत कुछ दिया है सकते हैं - कृपया दिखाने जो सटीक लाइन अपवाद फेंकता है। (इसे खोजने के लिए अपवाद स्टैक ट्रेस प्रिंट करें - न केवल संदेश ...) –
त्रुटि कहां होती है? –
मैंने code.problem डीबग नहीं किया है जब मैं contact.txt फ़ाइल में कम संख्या दे रहा हूं मुझे यह त्रुटि नहीं मिल रही है। जब मैं contact.txt फ़ाइल में 36000 नंबरों के साथ चल रहा हूं तो यह अमान्य पंक्ति संख्या त्रुटि – Cindrella