• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

jdbc related

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
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="jdbc:oracle: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();

}
}
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ravi is a string, it needs to be quoted with single quotes 'ravi'
 
I knew that guy would be trouble! Thanks tiny ad!
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic