Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jdbc related  RSS feed

karthik mama
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends,
the problem is i am getting a run time exception when i run this class file InsertRecord.....THE SOURCE CODE IS BENEATH

C:\mypgm>java InsertRecord
Exception in thread "main" java.sql.SQLException: ORA-00984: column not allowed

at oracle.jdbc.driver.DatabaseError.throwSqlException(
at oracle.jdbc.driver.T4CTTIoer.processError(
at oracle.jdbc.driver.T4CTTIoer.processError(
at oracle.jdbc.driver.T4C8Oall.receive(
at oracle.jdbc.driver.T4CStatement.doOall8(
at oracle.jdbc.driver.T4CStatement.executeForRows(
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatem
at oracle.jdbc.driver.OracleStatement.executeUpdate(
at InsertRecord.main(


import java.sql.*;
public class InsertRecord
public static void main(String args[]) throws Exception
String url="jdbcracle:thin:@localhost";
Connection con=DriverManager.getConnection(url,"system","mama");
Statement st=con.createStatement();
String sql="insert into employee values (1002,ravi,6000)";
int row=st.executeUpdate(sql);
System.out.println(row+"row created");

David O'Meara
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ravi is a string, it needs to be quoted with single quotes 'ravi'
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!