Analysis: The exception message indicates that the class cannot be found. The reason is that oracle.jdbc.OracleDriver is not loaded into the JVM. It may be because the JDBC driver jar package is not imported, or the parameters of the loaded driver are written incorrectly.
Solution: Check whether the JDBC driver jar package is imported in the project, or check whether the loaded driver parameters are correct.
2. SQLException: No suitable driver found for jdbc:orale:thin:@localhost:1521:xe
Reason: the url is wrong
Solution: carefully check your program url
3. SQLException: Listener refused the connection with the following error:xxxxx
Reason: the url is still wrong
4. SQLException: IO 错误: The Network Adapter could not establish the connection
Reason: The IP address in the URL is wrong, or there is a problem with the oracle service
5. SQLException: IO 错误: Invalid number format for port number
Reason: There is a problem with the port in the URL.
7. SQLException: Identifier is invalid/table or view does not exist/too many values/columns are not allowed here/missing from …, and locate the error row through the exception stack information, and locate stm.executeXX(sql)
Reason: sql statement is wrong
Common phenomena: a. Table or view does not exist: there is no table name or view name in sql in the library table
b. Invalid class name: there is no column to be operated on in the table
c. Invalid character: SQL syntax has problems
above Problem source code case show: there is a semicolon in sql
8. Properties cannot load configuration file
Analysis: The exception is a null pointer exception. The exception prompt shows that there is a problem with line 33 of JDBCUtils.java, the load load error, and the input stream transmitted in the load method is empty, that is, the configuration file information is not obtained.
Solution: Check whether the path of the configuration file is correct.
9. The database connection is null
Problem analysis: When jdbc is connecting to the database, if the database connection object conn used has been closed, this error will be reported
Solution: a. Make sure that the database connection is not closed in dao, and hand it over to the business layer to close the database connection . b. After making sure to close the database connection in the jdbc tool class, remove the current database connection from the current thread
10. JDBC can not find the data in the database
Problem description: Through the database interface or plsqldev (database operation tool) to query multiple data in the operation table, but the query result of connecting to the database through jdbc is inconsistent with the database result (the number of entries is small)
Reason analysis: a. First determine whether the database connected by jdbc and the database connected by plsqldev are the same database b. Determine whether the data viewed in plsqldev is in the rollback segment, that is, whether the transaction is not committed
Solution: Ensure that jdbc and plsqldev are connected to the same database. Ensure that the transaction has been committed.