Galera sei que já existe esse tópico , porém decidi abrir outro pois estou com um problema na hora de importação
a tabela que preciso importar esta dessa forma
CREATE TABLE [dbo].[STOP_ATIS2](
[CD_CLIENTE] [bigint] NULL,
[CD_CONTA] [bigint] NULL,
[QTDE] [int] NULL,
[VALOR] [decimal](10, 2) NULL,
[MOTIVO] varchar NULL,
[CONTA] [int] NULL,
[CICLO] [smallint] NULL,
[TERMINAL] [bigint] NULL
) ON [PRIMARY]
O xls que estou importando está assim!?
mas está importando da seguinte forma:
o código java que estou usando para pegar as informações do xls e importar é esse?! o que estou fazendo de errado galera que ele nao pega os valores corretos apenas os strings!?
import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import connectionfactory.telefonica.com.br.ConnectionFactory;
public class Principal {
private static int i =0;
private static Long stringa1;
private static Long stringa2;
private static Long stringa3;
private static float stringa4;
private static String stringa5;
private static Long stringa6;
private static Long stringa7;
private static Long stringa8;
public static void main(String []args) throws BiffException, IOException, SQLException{
Connection con = new ConnectionFactory().getConnection();
Workbook workbook = Workbook.getWorkbook(new File("C:/teste/stop_atisciclo02345.xls"));
Sheet sheet = workbook.getSheet(0);
int linhas = sheet.getRows();
for(i = 0; i < linhas; i++){
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);
stringa1 = (long) a1.getRow();
stringa2 = (long) b2.getRow();
stringa3 = (long) c3.getRow();
stringa4 = d4.getColumn();
stringa5 = e5.getContents();
stringa6 = (long) f6.getRow();
stringa7 = (long) g7.getRow();
stringa8 = (long) h8.getRow();
PreparedStatement st = con.prepareStatement("insert into STOP_ATIS2(cd_cliente,cd_conta,qtde,valor,motivo,conta,ciclo,terminal)"+"Values('"+stringa1+"','"+stringa2+"','"+stringa3+"','"+stringa4+"','"+stringa5+"','"+stringa6+"','"+stringa7+"','"+stringa8+"')");
st.executeUpdate();
}
workbook.close();
}
}
por favor peço a ajuda de vc´s gratos a quem puder me ajudar!! vale mesmo!