This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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'
 
reply
    Bookmark Topic Watch Topic
  • New Topic