![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Oct 2006
Posts: 4
Rep Power: 0
![]() |
Update Operation in JDBC
I am trying to update the database but it is showing the errors . I put the code , mysql table and the error showed at execution. Please cheak it.
File name is Firstapp.java
import java.sql.*;
import java.util.*;
import java.io.*;
class Firstapp
{
public static void main(String[] args) throws Exception,SQLException
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:mysql","","");
Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs=stmt.executeQuery("select * from account");
//Update Operation
rs.absolute(5);
rs.updateString("accname","evan");
rs.updateRow();
rs.close();
stmt.close();
con.close();
}
}The table in mysql is mysql> select * from account; +-------+---------+ | accno | accname | +-------+---------+ | 1 | pavan | | 2 | avan | | 3 | lavan | | 4 | ravan | | 5 | fvan | +-------+---------+ it is not showing any error while compilation Following is the error showing the while execution Exception in thread "main" java.sql.SQLException: [MySQL][ODBC 3.51 Driver][mysqld-4.0.13-nt]Degree of derived table does not m atch column list at sun.jdbc.odbc.JdbcOdbcResultSet.setPos(Unknown Source) at sun.jdbc.odbc.JdbcOdbcResultSet.updateRow(Unknown Source) at Firstapp.main(Firstapp.java:40) Insert and deleter operations are working fine and i could not able to find the problem with update operation. Please any body help me. |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| oledb update record problem | biran | C# | 6 | May 12th, 2006 12:13 AM |
| Update a Module | Dietrich | Python | 2 | Apr 29th, 2006 2:19 PM |
| JTree Display Update | masamae | Java | 2 | Jul 25th, 2005 11:41 AM |
| problem with JDBC for talking to Microsoft Access database using a Java Applet | captainK | Java | 4 | Mar 20th, 2005 12:01 PM |
| Type Mismatch Error = 13 | Benjizzle | Visual Basic | 5 | Mar 15th, 2005 6:23 PM |