Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Tim Cooke
Campbell Ritchie
paul wheaton
Ron McLeod
Devaka Cooray
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Paul Clapham
Saloon Keepers:
Tim Holloway
Carey Brown
Piet Souris
Bartenders:
Forum:
JDBC and Relational Databases
Error on Batch Update using Oracle
Tushar Ravi
Greenhorn
Posts: 10
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi there,
I am facing an error while executing the below code.
public void batchUpdate() throws Exception { Connection conn = null; PreparedStatement statement = null; StringBuilder sql = new StringBuilder(); try { conn = getOracleConnection(); // Using JDBC commands sql.append("INSERT INTO EMPLOYEE (ID,NAME) VALUES (1,'JOHN')"); sql.append("INSERT INTO EMPLOYEE (ID,NAME) VALUES (1,'JIM')"); statement = conn.prepareStatement(sql.toString()); statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { statement.close(); conn.close(); } }
The exception thrown is
java.sql.SQLException: ORA-00933: SQL command not properly ended
If i give semicolon at the end of the sqls i get
java.sql.SQLException: ORA-00911: invalid character
Any suggestions appreciated.
Thanks in advance
Tushar.
Rupesh Mhatre
Ranch Hand
Posts: 35
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
PreparedStatement statement = conn.prepareStatement("INSERT INTO EMPLOYEE (ID,NAME) VALUES (?,?)"); statement.setInt(1,1); statement.setString(2,"JOHN"); statement.addBatch(); statement.setInt(2,1); statement.setString(2,"JIM"); statement.addBatch(); statement.executeBatch();
I think this should help
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
"Function sequence error!" what is it mean
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
Java - Passing Object to Storeprocedure (Spring JDBCTemplate)
ORA-01460: unimplemented or unreasonable conversion requested
server goes into sleep state while executing "Connection con=datasource.getConnection
More...