Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error during batch update

 
karai baskar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Make sure Your are Using JDBC 2.0 version Api supported Driver .
 
karai baskar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic