This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes jdbc related Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc related" Watch "jdbc related" New topic
Author

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
connected
Exception in thread "main" java.sql.SQLException: ORA-00984: column not allowed
here


at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:145)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1111
)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1279)
at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatem
ent.java:1856)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java
:1821)
at InsertRecord.main(InsertRecord.java:12)


____________________________________________________________________________

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

}
}
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

ravi is a string, it needs to be quoted with single quotes 'ravi'
 
jQuery in Action, 2nd edition
 
subject: jdbc related