package test;
import java.sql.*;
public class ConnectionDatabase {
public static void main(String[] args)
{
try
{
Connection con=DriverManager.getConnection(url,username,password);
String query="insert into EMPLOYEE(idNo,name,phoneno,address,salary)"+
"values(1,'Mike',234232,'Queens',80000);";
Statement st= con.createStatement() ;
int rows =st.executeUpdate(query);
if(rows>0)
{
System.out.println("A row has been inserted");
}
con.close();
}catch(SQLException e)
{
System.out.println("error:-");
e.printStackTrace();
}
}
}
完成后,我得到这个错误error:-
java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:509)
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:461)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1104)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:550)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:655)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:229)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:41)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:928)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1205)
at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1747)
at oracle.jdbc.driver.OracleStatement.executeLargeUpdate(OracleStatement.java:1712)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1699)
at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:285)
at test.ConnectionDatabase.main(ConnectionDatabase.java:22)
Caused by: Error : 933, Position : 92, Sql = insert into EMPLOYEE(idNo,name,phoneno,address,salary)values(1,'Mike',234232,'Queens',80000);, OriginalSql = insert into EMPLOYEE(idNo,name,phoneno,address,salary)values(1,'Mike',234232,'Queens',80000);, Error Msg = ORA-00933: SQL command not properly ended
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:513)
... 14 more
暂无答案!
目前还没有任何答案,快来回答吧!