aspose file tools*
The moose likes JDBC and the fly likes error during batch update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "error during batch update" Watch "error during batch update" New topic
Author

error during batch update

karai baskar
Greenhorn

Joined: Nov 29, 2000
Posts: 17
hello friends
i am getting unsupportedoperation exception when i run this
program
import java.sql.*;
public class batch
{

public static void main(String arg[])
{
Connection conn=null;
ResultSet rs=null;
Statement stmt=null;
ResultSetMetaData rsmd=null;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc dbc:rst");
stmt=conn.createStatement();

conn.setAutoCommit(false);

stmt.addBatch("INSERT INTO student " +
"VALUES('Amaretto', 49, 'm')");
stmt.addBatch("INSERT INTO student " +
"VALUES('Hazelnut', 49,'m' )");
stmt.addBatch("INSERT INTO student " +
"VALUES('Amaretto_decaf', 49,'m')");
stmt.addBatch("INSERT INTO student " +
"VALUES('Hazelnut_decaf', 49,'m')");
int [] updateCounts = stmt.executeBatch();
System.out.println("inserted");
}
catch(ClassNotFoundException e){}
catch(SQLException sq){}
}
}
there is no error but operation not supported.what to do
pl help me in this
thanks for all
bye
baskar
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Your JDBC (or maybe ODBC) driver does not support one or more of the features you're trying to use. The line number quoted in the exception stack trace will tell you exactly which statement causes the exception and thereby which operation is not supported.
- Peter
hanumanth reddy
Ranch Hand

Joined: Jun 12, 2000
Posts: 118


Make sure Your are Using JDBC 2.0 version Api supported Driver .


<a href="http://www.jobklub.com" target="_blank" rel="nofollow">http://www.jobklub.com</a><br /> 'Add Job To Life'
karai baskar
Greenhorn

Joined: Nov 29, 2000
Posts: 17
hi,
yes i am using jdbc2.0 api supported driver.
i get the exception when the first statement
st.addBatch( ) gets executed.
bye
baskar
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by karai baskar:
yes i am using jdbc2.0 api supported driver.

Are you sure? The JDK1.2 bridge did not support it. The JDK1.3 one does -- at least, according to the documentation.
- Peter

 
 
subject: error during batch update