2016-04-12 21 views
1

İki gün boyunca bu sorunu yaşadım. Düşünebildiğim herşeyi denedim. Bu problem hakkında bana yardımcı olabilecek her türlü yardımı takdir ediyorum. Şimdiden teşekkürler. 'bildirimi " bir SQLException atıyor

try  { // try get tx records 
Class.forName("com.mysql.jdbc.Driver"); 
Connection con = DriverManager.getConnection ( 
"jdbc:mysql://localhost:3306/brent?user=root&password=adsimysql"); 
Statement stmt = con.createStatement(); System.out.println("aaactivity3"); 
ResultSet rs = stmt.executeQuery("Select * from " + tbtx); 
System.out.println("aaactivity4"); 
while (rs.next()) { // get tx records 
dbrec = rs.getInt("trec"); // get input fields from database 
dbacct = rs.getInt("tacct"); 
dbtxtype = rs.getInt("ttype"); 
dbtxno = rs.getInt("ttxno"); 
dbamt = rs.getDouble("tamt"); 
dbmed = rs.getDouble("tmed"); 
dbsaltx = rs.getDouble("tsaltx"); 
dbtxdat = rs.getInt("ttxdat"); 
dbxmail = rs.getInt("txmail"); 
dbbilldat = rs.getInt("tbilldat"); 
System.out.println("ApplyTX " + dbacct); // print 
//  try  { // try write ts 
//Class.forName("com.mysql.jdbc.Driver"); 
/*Connection con = DriverManager.getConnection ( 
"jdbc:mysql://localhost:3306/brent?user=root&password=adsimysql");   
Statement stmt = con.createStatement();*/ 
PreparedStatement prest; 
String updttx = "INSERT INTO "+ tbts + " (sacct, stype, srec, stxno, samt,   smed, sstax, stxdat, sxmail, sbilldat) VALUES (?,?,?,?,?,?,?,?,?,?)"; 
//String updttx; 
// updttx = "INSERT INTO "+ tbts + " (sacct, stype, srec, stxno, samt, smed, sstax, stxdat, sxmail, sbilldat) VALUES (?,?,?,?,?,?,?,?,?,?)"; 
prest = con.prepareStatement(updttx); 
System.out.println("aaactivity5 " + dbacct); 
prest.setInt(1,dbacct); 
prest.setInt(2,dbtxtype); 
prest.setInt(3,dbrec); 
prest.setInt(4,dbtxno); 
prest.setDouble(5,dbamt); 
prest.setDouble(6,dbmed); 
prest.setDouble(7,dbsaltx); 
prest.setInt(8,dbtxdat); 
prest.setInt(9,dbxmail); 
prest.setInt(10,dbbilldat); 
System.out.println("aaactivity6 "+ dbtxtype); 
int executeUpdate = prest.executeUpdate(); // this statement is throwing SQLException 
System.out.println("aaactivity7"); 
    } // end while get tx records 
} // end try get tx records and build ts file  ******************************** 
catch(ClassNotFoundException e) { 
} 
catch(SQLException insertException) {  System.out.println("SQLexception"+dbacct+" "+dbtxtype+" "+dbrec+" "+dbtxno+" "+dbamt+" "+dbmed+" "+dbsaltx+" "+dbtxdat+" "+dbxmail+" "+dbbilldat); 
//displaySQLErrors (insertException); 
} 
} // end no ts 
+1

adresinde tanımlanmış bir nitrilktir. Stacktrace'i catch bloğuna yazdırın! –

+1

istisnayı yazdırın ve sorunuzu düzeltin –

cevap

0

Yakalama bloğunuzda bu satırı ekleyin e.printStackTrace(). Kodunuzu çalıştırın ve excat hatasını kontrol edin. Ayrıca ttts nedir? bu tablo ismi mi? eğer tablo adının bulunduğu değişken ise, o zaman bu URL'de

+0

Sorunu çözdüm. Dosya açıklaması adları ile programda kullanılan adlar arasındaki eşsiz veri adları. – dlc

İlgili konular