File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes jdbc related Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "jdbc related" Watch "jdbc related" New topic

jdbc related

karthik mama
Ranch Hand

Joined: Aug 27, 2007
Posts: 34
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

Joined: Mar 06, 2001
Posts: 13459

ravi is a string, it needs to be quoted with single quotes 'ravi'
I agree. Here's the link:
subject: jdbc related
It's not a secret anymore!