JSP connection Oracle error: OCIJDBC8.DLL ALREADY LOADED Solution

xiaoxiao2021-03-05  21

Bean teaches this

/ *************************************************************************************** JAVA Connection Database Java Bean @ Author: Seaman JiangLast Modified: 23, APR, 2004 ******************************************* ************** / PACKAGE JWSYSTEM; import java.sql. *; import java.util. *; import java.io. *; import java.sql. *; / ** ******************************************** DBManager class Database connection management ****************************************************** *** /

public class dbManager {/ ** * constant definitions database connection * / private String myURL = "jdbc: oracle: oci8: @"; private String dbuser = "wwwwork"; private String dbpassword = "123"; protected Connection conn = null ; // connection protected; // statement protected resultset rest = null; // results

/ ** * connected database * / public void makeConnection () throws Exception {DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver ()); conn = DriverManager.getConnection (myURL, dbuser, dbpassword);} / ** * recordset returned * / public ResultSet RS_Query (String sql) throws Exception {rest = null; Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); rest = stmt.executeQuery (sql); return rest;} / * * * update execution returns to the operating state; * / public int RS_Execute (String sql) throws Exception {int success_update = 0; rest = null; Statement stmt = conn.createStatement (); success_update = stmt.executeUpdate (sql); return success_update } / ** * Clear connection * / public void takedown () throws exception {conn.close ();}}

Connect.jsp <% objdb.makeconnection ();%>

Why is the old Native Library C: /oraHome/bin/ocijdbc8.dll already loaded in Another ClassLoader only the first time is successful ~~~ Should be changed to the following: public class dbmanager {/ ** * Defines the constant of the database connection * / private String myURL = "jdbc: oracle: oci8: @"; private String dbuser = "wwwwork"; private String dbpassword = "123"; protected Connection conn = null; // Connection protected Statement stmt = null; // Statement protected ResultSet REST = null; // resultset

Static {drivermanager.registerDriver (new oracle.jdbc.driver.OracleDriver ());}

/ ** * Connection database * / public void makeconnection () throws exception {conn = drivermanager.getConnection (MyURL, DBUSER, DBPASSWORD);

// pay attention to this sentence and drivermanager.registerdriver (new oracle.jdbc.driver.Orcledriver ()); or class.Forname (STRDBDRIVER); to write, you can't write

Reference: http://search.9cbs.net/expert/topic/1704/1704531.xml? Temp = .3021204 Additional note: The table name in Oracle is case sensitive.

转载请注明原文地址:https://www.9cbs.com/read-36804.html

New Post(0)