Home > database >  An error! No suitable driver found for JDBC: oracle: thin: @ localhost: 1521: the former
An error! No suitable driver found for JDBC: oracle: thin: @ localhost: 1521: the former

Time:10-02

 Java. SQL. SQLException: No suitable driver found for JDBC: oracle: thin: @ localhost: 1521: former 
The at Java. SQL. DriverManager. GetConnection (Unknown Source)
The at Java. SQL. DriverManager. GetConnection (Unknown Source)
At com. HSP. Utils. SqlHelper. GetConnection (SqlHelper. Java: 67)
At com. HSP. Utils. SqlHelper. ExecuteQuery (SqlHelper. Java: 130)
At com. Base. Userservice2nd. CheckUser (userservice2nd. Java: 15)
The at cn. CheckServlet. DoGet (checkServlet. Java: 34)
The at cn. CheckServlet. DoPost (checkServlet. Java: 46)


 Java. Lang. NullPointerException 
At com. HSP. Utils. SqlHelper. ExecuteQuery (SqlHelper. Java: 131)
At com. Base. Userservice2nd. CheckUser (userservice2nd. Java: 15)
The at cn. CheckServlet. DoGet (checkServlet. Java: 34)
The at cn. CheckServlet. DoPost (checkServlet. Java: 46)
The at javax.mail. Servlet. HTTP. HttpServlet. Service (HttpServlet. Java: 650)
The at javax.mail. Servlet. HTTP. HttpServlet. Service (HttpServlet. Java: 731)

CodePudding user response:

Oracle. The properties
 dbUserName=Scott 
DbPassword=tiger
... DbDriver=the oracle JDBC driver OracleDriver
DbUrl=JDBC: oracle: thin: @ localhost: 1521: former


SqlHelper. Java
[code=javastatic
{
Try
{
//from the dbinfo properties
Pp=new Properties ();
Fis=SqlHelper. Class. GetClassLoader () getResourceAsStream (" oracle. The properties ");
//fis=new FileInputStream ();
Pp. The load (fis);
Url=pp. GetProperty (" dbUrl ");
Driver=pp. GetProperty (" dbDriver ");
The username=pp. GetProperty (" dbUserName ");
DbPassword passwd=pp. GetProperty (" ");

Class.forname (driver);
}
The catch (Exception e)
{
e.printStackTrace();
}
The finally
{
Try
{fis. Close (); }
The catch (IOException e) {e.p rintStackTrace (); }
Fis=null;//garbage recycle bin packing
}] [/code]

CodePudding user response:

Oracle driver ojdbc14. Jars have buildpath

CodePudding user response:

For ojdbc6 jar, in addition to the mistakes in the paper, reward Java. Lang. ClassNotFoundException: oracle.. JDBC driver. OracleDriver wrong,

CodePudding user response:

How much is the target database version?
Look from the mistake, didn't find the right driver package,
Whether confirm ojdbc6. Jar under the corresponding path

CodePudding user response:

I am using oracle11g, jars in the lib directory under the web - inf

CodePudding user response:

Without proper database driven, suggest you don't worry, first to the baidu to download a corresponding database 11 g driver, and then by loading in the explises external package to load the driver,
  • Related