1. 程式人生 > >stmt=conn.createStatement()報空指標錯誤——已解決

stmt=conn.createStatement()報空指標錯誤——已解決

連線資料庫 時,

stmt=conn.createStatement() 報空指標錯誤

java.lang.NullPointerException

原因是:

conn=connDB.getConnection();

而不是

connDB=connDB.getConnection();