Abaixo segue o código gerado, quando chego na última linha com informação no meu laço do/while dá erro, alguém já passou por isso ou sabe como trata-lo?
[code]package controleweb;
import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;
import jxl.Cell;
import jxl.DateCell;
import jxl.NumberCell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
/**
*
-
@author petter
*/
public class Main {private static Connection conn;
private static int i = 1;
private static Date datea1;
private static String stringb2;
private static double intc3;
private static String stringd4;
private static String stringe5;
private static String stringf6;
private static String stringg7;
private static String stringh8;
private static String stringi9;
private static String stringj10;/** Creates a new instance of Main */
public static void main(String[] args ) throws IOException, BiffException,
ClassNotFoundException, SQLException {/* pega o arquiivo do Excel */
Workbook workbook = Workbook.getWorkbook(new File(“enviados.xls”));/* pega a primeira planilha dentro do arquivo XLS */
Sheet sheet = workbook.getSheet(0);do{
/* pega os valores das células como se numa matriz */
Cell a1 = sheet.getCell(0,i);
Cell b2 = sheet.getCell(1,i);
Cell c3 = sheet.getCell(2,i);
Cell d4 = sheet.getCell(3,i);
Cell e5 = sheet.getCell(4,i);
Cell f6 = sheet.getCell(5,i);
Cell g7 = sheet.getCell(6,i);
Cell h8 = sheet.getCell(7,i);
Cell i9 = sheet.getCell(8,i);
Cell j10 = sheet.getCell(9,i);/* pega os conteúdos das células */
DateCell dc = (DateCell) a1;
datea1 = dc.getDate();stringb2 = b2.getContents();
NumberCell nc = (NumberCell) c3;
intc3 = nc.getValue();stringd4 = d4.getContents();
stringe5 = e5.getContents();
stringf6 = f6.getContents();
stringg7 = g7.getContents();
stringh8 = h8.getContents();
stringi9 = i9.getContents();
stringj10 = j10.getContents();//Auto incremento para pular de linhas na planilha do Excell
i++;
}while(stringg7 != null);/Executa o insert para inserir os dados no banco de testes MySQL/
Class.forName(“com.mysql.jdbc.Driver”);Connection conn = DriverManager.getConnection(“jdbc:mysql://127.0.0.1:3306/jar”,
“user”,
“senha”);PreparedStatement ps = conn.prepareStatement(“INSERT INTO Teste(data,hora,tamanho,ip,” +
" string1,string2,de," +
" para,cc,titulo) “+
“VALUES(’”+datea1+”’,’"+stringb2+"’,’"+intc3+"’,’"+stringd4+"’,’"+stringe5+"’" +
" ,’"+stringf6+"’,’"+stringg7+"’,’"+stringh8+"’,’"+stringi9+"’,’"+stringj10+"’)");ps.executeUpdate();
ps.close();workbook.close();
}
}
[/code]