No suitable driver found for “jdbc:oracle:thin:@**** ”oracle/jdbc/driver/OracleDriver";

前端 未结 3 2000
灰色年华
灰色年华 2021-01-19 02:47

here is my java code

public static Map propertyFileReader() {
    Map map=new HashMap();
           


        
3条回答
  •  自闭症患者
    2021-01-19 03:46

    This answer is a "bit" late, but the accepted answer is not correct, so I post this for anybody unfortunate enough to attempt to copy/paste the code and wondering what went wrong.

    The accepted answer is so far correct that

    oracle.jdbc.driver.OracleDriver

    is deprecated, but it is still working in 2020. The problem with the posted code is that the properties file is using semicolons and quotation marks, which are not valid. So changing the properties file from

    DB_DRIVER = "oracle.jdbc.driver.OracleDriver";
    DB_CONNECTION2 = "jdbc:oracle:thin:@10.2.5.23:1521:dbslic";
    DB_USER = "TSR_MOBILE";
    DB_PASSWORD = "TSR_MOBILE";
    

    to

    DB_DRIVER = oracle.jdbc.driver.OracleDriver
    DB_CONNECTION2 = jdbc:oracle:thin:@10.2.5.23:1521:dbslic
    DB_USER = SR_MOBILE
    DB_PASSWORD = TSR_MOBILE
    

    makes the error go away.

提交回复
热议问题