经常遇到一些java.sql.SQLException异常

经常遇到一些java.sql.SQLException异常,从网上汇集一些前人的资料,将英文原文一并列出,以供以后调试查阅!
ORA-00904: invalid column name 无效列名
ORA-00942: table or view does not exist 表或者视图不存在
ORA-01400: cannot insert NULL into () 不能将空值插入
ORA-00936: 缺少表达式
ORA-00933: SQL 命令未正确结束
ORA-01722: 无效数字:(一般可能是企图将字符串类型的值填入数字型而造成)
ORA-06530: ACCESS_INTO_NULL 
Your program attempts to assign values to the attributes of an uninitialized (atomically null) object.
企图将值写入未初化对象的属性
ORA-06592: CASE_NOT_FOUND
None of th choice in the WHEN clauses of a CASE statement is selected, and there is no ELSE clause.
case语句格式有误,没有分支语句
ORA-06531: COLLECTION_IS_NULL
Your program attempts to apply collection methods othe than EXIST to an uninitialized(atomically null) nested table or varray, or th program attempts to assign values to the elements of an uninitialized nested table or varray.
企图将集合填入未初始化的嵌套表中
ORA-06511: CURSOR_ALREADY_OPEN
Your program attempts to open an already open cursor. A cursor must be closed before it can be reopened. A cursor FOR loop automatically opens the cursor to which it refers. So, your program cannot open that cursor inside the loop.
企图打开已经打开的指针.指针已经打开,要再次打开必须先关闭.
ORA-00001: DUP_VAL_ON_INDEX
Your program attempts to store duplicate values in a database column that is constrained by a unique index.
数据库字段存储重复,主键唯一值冲突
ORA-01001: INVALID_CURSOR 无效指针
Your program attempts an illegal cursor operation such as closing an unopened cursor.
非法指针操作,例如关闭未打开的指针
ORA-01722: INVALID_NUMBER 无效数字
In a SQL statement, the conversion of a character string into a number fails because the string does not represent a valid number. (In procedural statements, VALUE_ERROR is raised.) This exception is also raised when the LIMIT-clause expression in a bulk FETCH statement does not evaluate to a positive number.
在sql语句中,字符数字类型转换错误,无法将字符串转化成有效数字.此错误也可能因为在limit从句表达式中fetch语句无法对应指定数字
ORA-01017: LOGIN_DENIED 拒绝访问
Your program attempts to log on to Oracle with an invalid username and/or password.
企图用无效的用户名或密码登录oracle
ORA-01403: NO_DATA_FOUND 无数据发现
A SELECT INTO statement returns no rows, or your program references a deleted element in a nested table or an uninitialized element in an index-by table. SQL aggregate functions such as AVG and SUM always return a value or a null. So, a SELECT INTO statement that calls an aggregate function never raises NO_DATA_FOUND. The FETCH statement is expected to return no rows eventually, so when that happens, no exception is raised.

ORA-01012: NOT_LOGGED_ON 未登录
Your program issues a database call without being connected to Oracle.
程序发送数据库命令,但未与oracle建立连接

ORA-06501: PROGRAM_ERROR 程序错误
PL/SQL has an internal problem.
pl/sql系统问题

ORA-06504: ROWTYPE_MISMATCH 行类型不匹配
The host cursor variable and PL/SQL cursor variable involved in an assignment have incompatible return types.
For example, when an open host cursor variable is passed to a stored subprogram, the return types of the actual and formal parameters must be compatible.

ORA-30625: SELF_IS_NULL
Your program attempts to call a MEMBER method on a null instance. That is, the built-in parameter SELF (which is always the first parameter passed to a MEMBER method) is null.

ORA-06500: STORAGE_ERROR 存储错误
PL/SQL runs out of memory or memory has been corrupted.
PL/SQL运行内存溢出或内存冲突

ORA-06533: SUBSCRIPT_BEYOND_COUNT 子句超出数量
Your program references a nested table or varray element using an index number larger than the number of elements in the collection.

ORA-06532: SUBSCRIPT_OUTSIDE_LIMIT 子句非法数量
Your program references a nested table or varray element using an index number (-1 for example) that is outside the legal range.

ORA-01410: SYS_INVALID_ROWID 无效的字段名
The conversion of a character string into a universal rowid fails because the character string does not represent a valid rowid.

ORA-00051: TIMEOUT_ON_RESOURCE 资源等待超时
A time-out occurs while Oracle is waiting for a resource.

ORA-01422: TOO_MANY_ROWS 返回超过一行
A SELECT INTO statement returns more han one row.

ORA-06502: VALUE_ERROR 值错误
An arithmetic, conversion, truncation, or size-constraint error occurs. For example, when your program selects a column value into a character variable, if the value is longer than the declared length of the variable, PL/SQL aborts the assignment and raises VALUE_ERROR. In procedural statements, VALUE_ERROR is raised if the conversion of a character string into a number fails. (In SQL statements, INVALID_NUMBER is raised.)

ORA-01476: ZERO_DIVIDE 除0错误
Your program attempts to divide a number by zero.
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: java.sql.SQLException是一个Java编程语言中的异常类,表示在执行SQL语句时发生了错误。它通常是由于SQL语句中的语法错误、数据库连接问题、数据类型不匹配等原因引起的。当程序遇到这个异常时,通常需要检查SQL语句和数据库连接是否正确,并对错误进行处理。 ### 回答2: JavaSQL异常Java程序中常见的异常之一,也是最常见的数据库异常之一。SQLException是一个受查异常,意味着如果未处理该异常,程序将无法编译。 SQLException通常是在与数据库交互时,例如连接数据库、插入、删除或更新数据时抛出的。它指示发生了一个错误,并且该错误可能涉及到数据库连接失败、传递错误的SQL语句或执行中断等问题。 SQLException通常包括以下信息: 1. SQL语法错误或格式不正确 2. 数据库无法连接 3. 查询语句在数据库中不存在 4. 数据库出现锁定或死锁情况 5. 数据库关闭或网络中断 对于SQLException应该采取什么措施会因为具体情况而异。一般情况下,应该将SQLException封装在Java异常处理程序中。代码应该记录并报告该异常以帮助修复错误,并保持程序正常运行。 在处理SQLException时,可以考虑以下解决方法: 1. 检查SQL查询语句 尝试执行查询是否输入正确,并确保没有语法错误或输入错误。 2. 检查数据库连接 尝试在数据库中创建连接,并确保连接正常工作。 3. 检查数据库日志 数据库日志可能包含受影响的表和数据。查看日志以确定发生的问题并尝试解决。 4. 更新数据库版本 有时候正在使用的数据库与当前版本的Java或其他依赖程序之间存在冲突。在这种情况下,升级数据库的版本可能有助于解决问题。 总之,SQLExceptionJava中一个重要的异常,在数据库操作中十分常见。在编写Java数据库应用程序时,需要关注并妥善处理SQLException,确保程序顺利跑起来。 ### 回答3: java.sql.sqlexception是一个Java编程语言中的异常类,用于处理与SQL数据库程序相关的异常。这个异常类是在Java.sql包中的,它具有许多子类,每个子类代表了不同的SQL异常。 在实际编程中,如果开发人员在使用Java与数据库交互的过程中出现了问题,系统会抛出java.sql.sqlexception异常,表示程序在执行SQL命令时出现了错误。常见的错误类型包括:数据表不存在、语法错误、数据类型不匹配等。 当出现这种异常时,开发人员需要进行相应的处理,避免程序因异常而中断。常见的处理方法包括捕捉异常并进行处理、记录异常日志、对数据库进行检查和修复等。如果程序中没有正确处理这种异常,可能会导致程序异常终止或数据损坏等问题。 为了避免出现java.sql.sqlexception异常,开发人员应该遵循一些最佳实践,如谨慎使用数据库的事务操作、确保数据合法性、对数据库进行定期维护等。只有这样,才能确保程序的稳定性和数据的完整性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值