jdbc连接oracle数据库出现了ORA-00923: 未找到要求的 FROM 关键字错误 5
我是新建的oracle用户实例,文字的编码为我的myeclipse的编码是utf-8我的代码是packagejdbc;importjava.sql.DriverManag...
我是新建的oracle用户实例,文字的编码为
我的myeclipse的编码是utf-8
我的代码是
package jdbc;
import java.sql.DriverManager;
import java.sql.*;
public class Jdbc_1 {
private static final String URL="jdbc:oracle:thin:@localhost:1521:myora1";
private static final String USER="system";
private static final String PASSWORD="Nicaia521";
public static void main(String[] args)throws Exception
{
//1.加载数据库驱动
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
//DriverManager.registerDriver(new com.)
DriverManager.getConnection(URL, USER, PASSWORD);
//2.获得数据库连接
Connection conn=DriverManager.getConnection(URL, USER, PASSWORD);
//3.通过数据库连接操作数据库,实现增删查改
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * form table1");
while(rs.next())
{
System.out.println(rs.getString("name"));
}
}
}
错误是
Exception in thread "main" java.sql.SQLSyntaxErrorException: ORA-00923: 未找到要求的 FROM 关键字
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:194)
at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:853)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1145)
已经解决了,谢谢 展开
我的myeclipse的编码是utf-8
我的代码是
package jdbc;
import java.sql.DriverManager;
import java.sql.*;
public class Jdbc_1 {
private static final String URL="jdbc:oracle:thin:@localhost:1521:myora1";
private static final String USER="system";
private static final String PASSWORD="Nicaia521";
public static void main(String[] args)throws Exception
{
//1.加载数据库驱动
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
//DriverManager.registerDriver(new com.)
DriverManager.getConnection(URL, USER, PASSWORD);
//2.获得数据库连接
Connection conn=DriverManager.getConnection(URL, USER, PASSWORD);
//3.通过数据库连接操作数据库,实现增删查改
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * form table1");
while(rs.next())
{
System.out.println(rs.getString("name"));
}
}
}
错误是
Exception in thread "main" java.sql.SQLSyntaxErrorException: ORA-00923: 未找到要求的 FROM 关键字
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:194)
at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:853)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1145)
已经解决了,谢谢 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏5(财富值+成长值)
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询