常见BUG整理

1.访问数据库相关

Err:
can not convert from java.sql.Statement to java.beans.Statement 

import错误的包
java.sql.Statement这个是和数据连接有关
java.beans.Statement是javabean包123456

Err:
com.microsoft.sqlserver.jdbc.SQLServerException: 只进结果集不支持请求的操作。

//数据指针只能向后移动,且可更改数据
stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);

将 ResultSet.TYPE_FORWARD_ONLY修改为 ResultSet.TYPE_SCROLL_SENSITIVE1234567

FQ:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
不加载JDBC驱动一样能连接数据库

JDBC4.0 是不用显式的去加载驱动,如果驱动包符合 SPI 模式就会自动加载
2.

访问数据库相关

Err:
String dbURL = "jdbc:sqlserver://localhost:1433/STUDENT;";
com.microsoft.sqlserver.jdbc.SQLServerException: 端口号 1433/STUDENT 无效。

Java连接 MySQL和SQL Server不同
String sqlServerURL = "jdbc:sqlserver://localhost:1433;dataBaseName=STUDENT;";

String MySqlURL = "jdbc:mysql://localhost:3306/STUDENT";

3.

泛类型

class Test2 <T> {
    static void printList(List<? extends T> c) {
        for(T item : c) {
            System.out.println(item);
        }
    }
}
Err:Cannot make a static reference to the non-static type T

<T>表示是个泛型方法,传入参数有泛型
static <T> void printList(List<? extends T> c) {
       ...
}
4.

 CMD运行java

错误:找不到或无法加载主类
命令格式:
java -cp ../../ com.Section_23.Server

../../ 返回包所在位置(相对路径) 或者使用绝对路径
com.Section_23.Server 包名+类名

//javac A.java B.java
5.1.ext日历控件的问题
this.render为空  this.render(this.el.dom.parentNode)
dom节点未加载尚不可用,需要将js放置其后
5.2.jsp中将this对象传入js中
<input style="width:60px" name="qtyPerPK" value="" onblur="autoGenValueOfnumOfPKS($(this))"/>
function autoGenValueOfnumOfPKS(r) {
    alert(r.val());
}
5.3.关于innerHTML和value值
document.getElementsByName("obj")[0].innerHTML取得是文本内容默认为String类型
如果要跟数字进行比较需要parseInt()转换为int类型
5.4.设置输入框中只能输入数字不能输入字符或中文
onkeyup="this.value=this.value.replace(/[^\d\.]/g,'')"  onafterpaste="this.value=this.value.replace(/[^\d\.]/g,'')"
5.5.单双引号内嵌时使用转义字符

6.Null Reference Exception: Object reference not set to an instance of an object
空指针(引用)异常,

7.Unassigned Reference Exception: The variable cube of lesson03 has not been assigned.
You probably need to assign the cube variable of the lesson03 script in the inspector.
未赋值指针异常


8.UnityException: Tag: 小猪佩奇 is not defined.


9.ArgumentException: The Object you want to instantiate is null.
参数异常,参数为空

10.You are trying to create a MonoBehaviour using the 'new' keyword.  
This is not allowed.  MonoBehaviours can only be added using AddComponent().  
MonoBehaviour脚本不能New


11.Cant add Script Exception...
脚本的组件名和类名不一致


12.MissingComponentException: There is no 'Rigidbody' attached to the
丢失组件异常,Rigidbody没有被添加

猜你喜欢

转载自blog.csdn.net/qq_42436644/article/details/85369533