jdbc related
posted 18 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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();
}
}
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();
}
}
posted 18 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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 |







