Hai Guys, Thanks for your kind attntion about my software development project!
I have a poroblem in ODBC _ JDBC connection infact the code is working properly, but there is bug in my loob condition and Resultset.next(); mehtod;
I'll give more explanation adout the project;
we need to update records from an excel sheet ( should not be use any convertable softwares !) to MYSQL database. so, I created odbc connection for the excel sheet and jdbc connection to sql database. The excel sheet columns are 1. email address and 2.category there are thress conditions avalable for this process !
1. if a same record avalable both sql and excle sheet with out change any changes of email or category, it should not be insert or update !
2. if a same record avalable both aql and excel sheet but the email address is equal and deferant category it should update the current cetegory inthe sql database !
3. esle the new record should be inserted.
I made the java code as this but it not working properly and it trys to duplecate the same record
If you have a differenat idea about this pls send to me
**** remeber unspecified have been validated in mamber field *******************
[edited to add code tags]
guys if you have any idea adout this code's bug pls reply me ! Thanks agein ! [ November 17, 2006: Message edited by: Jeanne Boyarsky ]
Sumedha, I see a couple of things that could cause a problem: 1) while((rsdb.next())||(rsxl.next())) - Why are you looping through both resultsets here? The excel document is already being looped through in the outer loop. 2) if(excelemail.equals(dbemail) && (!excelcategory.equals(dbcategory))) - If the e-mails weren't equal, the code wouldn't get to this point because it wouldn't have made it to the else and would have just done "continue next" 3) p.execute() - Gets called without setting the parameters/binding variables for the prepared statement.
Note that using labels for continue (next is usually considered poor practice. It makes the code more difficult to understand and maintain.
Try writing a method (it doesn't need to compile) with just the control logic. That way you have the logic done before complicating it with JDBC.