I try to connect my JavaEE to the Oracle database. If I test the connection from any IDE like DBeaver or from a command prompt there is no problem. I use Eclipse for IDE and Windows 10 for OS. What I tried?
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","password");
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/xe","system","password");
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","password");
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","system","password");
I changed ojdbc14 to ojdbc6
I changed drivers and tried to connect to different databases SQL Server and MySql but always throws an exception on Class.forName java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS: listener does not currently know of SID given in connect descriptor The Connection descriptor used by the client was: localhost:1521:xe
lsnrctl statusand see if you find any configuration errors. See if this post helps ibm.com/support/pages/…