java.sql.SQLException:ORA-00918:未明确定义列

suny51332022-10-04 11:39:541条回答

java.sql.SQLException:ORA-00918:未明确定义列
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:830)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2391)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2672)
at oracle.jdbc.driver.OraclePreparedStatement.doScrollPstmtExecuteUpdate(OraclePreparedStatement.java:3989)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:623)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:527)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
at com.base.db.JDBCDataStore.preparedQuery(JDBCDataStore.java:341)
at com.base.db.JDBCDataStore.preparedQueryByPage(JDBCDataStore.java:471)
at com.Xiangbeipld.source.pro.command.GoodsInfoManager.searchExGoods(GoodsInfoManager.java:190)
at com.Xiangbeipld.source.pro.command.GoodsInfoManager.execute(GoodsInfoManager.java:156)
at com.base.command.JDBCCommandExecutor.execute(JDBCCommandExecutor.java:24)
at com.base.command.Executor.execute(Executor.java:35)
at com.base.command.Executor.execute(Executor.java:15)
at com.Xiangbeipld.source.pro.action.GoodsInfotAction.execute(GoodsInfotAction.java:31)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at com.base.web.CharsetFilter.doFilter(CharsetFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)

已提交,审核后显示!提交回复

共1条回复
rammer 共回答了22个问题 | 采纳率81.8%
检查你的SQL语句:查询的列在数据库表里不存在!
重名的列,前面没加表名或别名
1年前

相关推荐

java.sql.SQLException:Operation not allowed after ResultSet
java.sql.SQLException:Operation not allowed after ResultSet closed
rs4=stmt1.executeQuery("select * from hr_person where loginCode='"+person.getLoginCode()+"'");
if (rs4.next()==false) {
rs=stmt1.executeQuery("select * from hr_role where name='"+person.getRole().getName()+"'");
while (rs.next()) {
System.out.println(rs.getString("id"));
String sql1 = "insert into hr_person(loginCode,loginPwd,role_id) values ("+"'"+person.getLoginCode()+"'"+","+"'"+person.getLoginPwd()+"'"+","+"'"+rs.getString("id")+"'"+")";
stmt1.executeUpdate(sql1);
rs3=stmt1.executeQuery("select * from hr_person where loginCode='"+person.getLoginCode()+"'");
while (rs3.next()) {
System.out.println(rs3.getString("id"));
String ids=rs3.getString("id");
rs1=stmt1.executeQuery("select * from hr_dept where name='"+person.getDept().getName()+"'");
while (rs1.next()) {
String sql2 = "update hr_person as p set p.dept_id="+"'"+rs1.getString("id")+"'"+"where id="+"'"+ids+"'";
stmt1.executeUpdate(sql2);
rs2=stmt1.executeQuery("select * from hr_resume where name='"+person.getResume().getName()+"'");
while (rs2.next()) {
System.out.println(rs2.getString("id"));
String sql3 = "update hr_person as p set p.resume_id="+"'"+rs2.getString("id")+"'"+"where id="+"'"+ids+"'";
stmt1.executeUpdate(sql3);
}
}
}
}
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}finally{
if (rs2!=null) {
rs2.close();
}
if (rs1!=null) {
rs1.close();
}
if (rs3!=null) {
rs3.close();
}
if (rs!=null) {
rs.close();
}
if (rs4!=null) {
rs4.close();
}
con.close();
con1.close();
}
}
MICK_XIANG1年前1
情侯 共回答了19个问题 | 采纳率94.7%
你还是试试把finally里面的
if (rs1!=null) {
rs1.close();
}
if (rs3!=null) {
rs3.close();
}
if (rs!=null) {
rs.close();
}
if (rs4!=null) {
rs4.close();
}
都去掉,只留一个rs2的.看看行不行.我刚才看到说一个stmt1始终只对应一个结果集,当你操作下面的时候,前面的已经关闭掉了.
java.sql.SQLException:Io 异常:The Network Adapter could not es
java.sql.SQLException:Io 异常:The Network Adapter could not establish the connection
刚刚安装的oracle 10g ,oracle 实例和 监听器都正确启动,但是用DB
连接的时候就出现了这个错误.我的java 源代码如下
package demo1;
import java.awt.Toolkit;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
public class test2 {
x05private String driver = "oracle.jdbc.driver.OracleDriver";
x05private String url = "jdbc:oracle:thin:@Yaxin-PC:1521:orcl";
x05private Connection con = null;
x05private String user = "scott";
x05private String login = "tiger";
x05private Statement st = null;
x05private ResultSet rs = null;
x05
x05public test2()
x05{
x05x05try {
x05x05x05Class.forName(this.driver);
x05x05x05this.con = DriverManager.getConnection(this.url,this.user,this.login);
x05x05x05this.con.setAutoCommit(false);
x05x05x05if(this.con!=null)
x05x05x05{
x05x05x05x05x05x05x05x05System.out.println("连接成功");
x05x05x05}
x05x05} catch (ClassNotFoundException e) {
x05x05x05System.out.println("连接失败 1");
x05x05} catch (SQLException e) {
x05x05x05e.printStackTrace();
x05x05x05System.out.println("连接失败");
x05x05}x05
x05}
x05
x05public static void main(String args[])
x05{
x05x05test2 test2 = new test2();
x05}
}
另外,在SQL PLUS 上面可以进行正确的登录和操作,但是用正确的用户名和密码登录 PL SQL Developer时 就出现错误 TNS:连接超时的错误.
这两个中有么有关系呢?是不是我的oracle安装有错误呢?
风草鱼1年前1
雪地草原 共回答了21个问题 | 采纳率95.2%
外部知道
Yaxin-PC
这个吗,嗯,也就是侦听串里有没有这个,在
oracleproduct10.2.0client_1NETWORKADMINtnsnames.ora
这个文件里有没有,
你在hosts里加上试试
java.sql.SQLException:Couldn't perform the operation prepare
java.sql.sqlexception:couldn't perform the operation preparestatement:you can't perform any operations on this connection.it has been automatically closed by proxool for some reason (see logs).
x05at org.logicalcobwebs.proxool.wrappedconnection.invoke(wrappedconnection.java:207)
x05at org.logicalcobwebs.proxool.wrappedconnection.intercept(wrappedconnection.java:87)
x05at $java.sql.connection$$enhancerbycglib$$cb568e8f.preparestatement()
x05at sun.reflect.generatedmethodaccessor79.invoke(unknown source)
x05at sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25)
x05at java.lang.reflect.method.invoke(method.java:597)
x05at com.ibatis.common.jdbc.logging.connectionlog***.invoke(connectionlog***.java:53)
x05at $***0.preparestatement(unknown source)
x05at com.ibatis.sqlmap.engine.execution.sqlexecutor.preparestatement(sqlexecutor.java:494)
x05at com.ibatis.sqlmap.engine.execution.sqlexecutor.access$000(sqlexecutor.java:39)
x05at com.ibatis.sqlmap.engine.execution.sqlexecutor$batch.addbatch(sqlexecutor.java:583)
x05at com.ibatis.sqlmap.engine.execution.sqlexecutor.addbatch(sqlexecutor.java:104)
x05at com.ibatis.sqlmap.engine.mapping.statement.generalstatement.sqlexecuteupdate(generalstatement.java:197)
x05at com.ibatis.sqlmap.engine.mapping.statement.generalstatement.executeupdate(generalstatement.java:78)
x05at com.ibatis.sqlmap.engine.impl.sqlmapexecutordelegate.insert(sqlmapexecutordelegate.java:447)
x05at com.ibatis.sqlmap.engine.impl.sqlmapsessionimpl.insert(sqlmapsessionimpl.java:82)
x05at com.gdcn.sms.dao.ibatis.taskdaoimpl$3.doinsqlmapclient(taskdaoimpl.java:599)
x05at org.springframework.orm.ibatis.sqlmapclienttemplate.execute(sqlmapclienttemplate.java:209)
x05at com.gdcn.sms.dao.ibatis.taskdaoimpl.batchinsertsmssendstate(taskdaoimpl.java:589)
x05at com.gdcn.sms.thread.mythread.run(mythread.java:21)
叮叮口当口当1年前4
烟火未央亲 共回答了15个问题 | 采纳率100%
数据库连接池Proxool 管理的数据库连接,在这个操作前,已经被关闭.可以重新创建一个
java.sql.SQLException:The transaction is no longer active-st
java.sql.SQLException:The transaction is no longer active-status:'Rolled back.[Reason=Unknow]'.
Check the SQL Statement (preparation failed).
--- Cause:java.sql.SQLException:The transaction is no longer active - status:'Rolled back.[Reason=Unknown]'.No further JDBC access is allowed within this transaction.; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/ytincl/etms/system/login/dao/Login-SqlMap.xml.
--- The error occurred while executing query.
请问谁知道这是什么问题,这个错误出现特别少,几天才出现一次需要重启才能正常,
molly18lau1年前2
5201314有 共回答了16个问题 | 采纳率87.5%
事务已经被回滚了,所以你不能继续操作了.说明如果你的数据库操作一切正常的情况下你应该不会出现任何问题,但是,如果一旦出现问题,回滚以后,你依然在用这个transaction进行数据库的操作,这样的代码肯定是有问题的.
你去检查下吧,如果出现回滚后,应该直接报错.然后重新操作,重新begin transaction.
(一定赚了分才采纳) java.sql.SQLException:关闭的 Resultset:next
(一定赚了分才采纳) java.sql.SQLException:关闭的 Resultset:next
String sql="select * from t_student";
x05x05List list = jdbcTemplate.query(sql,new RowMapper() {
x05x05x05public Object mapRow(ResultSet rs,int arg1) throws SQLException {
x05x05x05x05List list = new ArrayList();
x05x05x05x05try {
x05x05x05x05x05
x05x05x05x05x05x05while (rs.next()) {
x05x05x05x05x05x05.x05
}
而且异常指向的是这一行:
List list = jdbcTemplate.query(sql,new RowMapper()
梧桐听雨1年前1
i_dq2b06ca5b96 共回答了16个问题 | 采纳率81.3%
while (rs.next()) {
x05x05x05x05x05x05.x05
}
这个不需要这么写,直接写
Students st = new Students();
st.setName(rs.getString(1));
list.add(st);
因为是每行结果所以你再rs.next()就报错了,已经被关闭了,你看,mapRow的意思就是每行
java.sql.SQLException:Field 'ReviewId' doesn't have a defaul
java.sql.SQLException:Field 'ReviewId' doesn't have a default value 这到底是怎么回事,
出错啦
java.sql.SQLException:Field 'ReviewId' doesn't have a default value
x05at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
x05at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
x05at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
x05at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1169)
x05at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:693)
x05at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1404)
x05at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1318)
x05at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1303)
x05at dao.ReviewDAO.insert(ReviewDAO.java:33)
x05at servlet.AddReviewServlet.doGet(AddReviewServlet.java:31)
x05at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
x05at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
x05at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
x05at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
x05at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
x05at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
x05at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
x05at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
x05at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
x05at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
x05at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
x05at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
x05at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
x05at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
x05at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
x05at java.lang.Thread.run(Thread.java:619)
妖精徒弟1年前5
hsu59 共回答了17个问题 | 采纳率88.2%
你的问题我推测有两种情况:
1,如果 ReviewId 为你的一个表的主键,你应该把它设置成自动增长类型
2,如果为非主键你需要把它设置成允许为空或者附默认值
具体操作可以查看mysql相关数据的操作:
ALTER TABLE 表名 MODIFY ReviewId BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY;
java.sql.SQLException: Illegal operation on empty result set
java.sql.SQLException: Illegal operation on empty result set.
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
public class shujuku {
public static void main(String args[]) {
Connection conn;
conn = Conn.getCon();
try{
Statement stmt = conn.createStatement();
ResultSet sql1=stmt.executeQuery("select * from register where name='cai'");
String iping = sql1.getString("psw");
int porting=sql1.getInt("psw2");
System.out.println(iping);
System.out.println(porting);
}catch(Exception e){
e.printStackTrace();
System.out.println("怎么会有错");
}
}
}
这个怎么错了,麻烦帮我看一下,谢谢啊
Dmm猎手H1年前4
雪笠 共回答了22个问题 | 采纳率90.9%
ResultSet 是个结果集.不能这样取记录的sql1.getString("psw");
需要循环历遍的.那怕结果集返回的只有一条记录
改成这样看看.
public static void main(String args[]) {
Connection conn;
conn = Conn.getCon();
try{
Statement stmt = conn.createStatement();
ResultSet sql1=stmt.executeQuery("select * from register where name='cai'");
while(sql1.next()){
String iping = sql1.getString("psw");
int porting=sql1.getInt("psw2");
System.out.println(iping);
System.out.println(porting);
}
}catch(Exception e){
e.printStackTrace();
System.out.println("怎么会有错");
}
}
求 java java.sql.SQLException:The Network Adapter could not e
求 java java.sql.SQLException:The Network Adapter could not establish the connection
我写了一个链接 oracle 的servlet 小程序,报的上面的错 ,然后我再写个测试的 JDBC 程序,都能通过 ,能打印出数据库中的内容,测试没问题.为什么servlet 访问的时候 后台 tomcat 就报上面这个错啊,tomcat 6.0 不行,我试了 5.0 也不行
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl","scott","orcl");
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from tb_agent_ofr");
} 大概就这这样了 ,我做了JDBC 测试 能通的
粗中有细啊1年前1
外来人员 共回答了18个问题 | 采纳率83.3%
("jdbc:oracle:thin:@localhost:1521:ORCL","scott","tiger"); 这行出错了,你看看你数据库实例 用户名 密码 写错了没
ibatis的问题java.sql.SQLException: Error: executeQueryForObject
ibatis的问题
java.sql.SQLException: Error: executeQueryForObject returned too many results.
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:124)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:110)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:86)
at com.cgj.dao.EmployeeDaoImpl.select(EmployeeDaoImpl.java:13)
at com.cgj.serice.ServiceImpl.selectEmployee(ServiceImpl.java:44)
at com.cgj.main.Testit.main(Testit.java:24)
Exception in thread "main" java.lang.NullPointerException
at com.cgj.main.Testit.main(Testit.java:25)
请问这是什么错误
orrtty1年前1
不许打我家猫 共回答了15个问题 | 采纳率86.7%
eturned too many results说的是返回的值多于一个了,executeQueryForObject要求只返回一个值,看看你的这个查询是应该用executeQueryForList,还是本身的Sql有问题
java.sql.SQLException:Wrong number of parameters是什么意思,就是修改内容
java.sql.SQLException:Wrong number of parameters是什么意思,就是修改内容的时候报异常
java.sql.SQLException:Wrong number of parameters:expected 2,was given 3 Query:update tb_users set username=?where username=?Parameters:[update tb_users set password=?where username=?,update tb_users set authority=?where username=?,[zhaoliu,456 ,1 ]]
at org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:320)
at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:489)
at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:455)
at com.vanceinfo.servlet.UserServlet.update(UserServlet.java:219)
at com.vanceinfo.servlet.UserServlet.doPost(UserServlet.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
at java.lang.Thread.run(Thread.java:619)
jian2131年前1
sdjnlzf 共回答了26个问题 | 采纳率92.3%
看错误提示,你的sql语句只需要2个参数,而你提供了三个值value,请仔细检查一下的代码
update tb_users set username=?where username=?