环境版本:
数据库:ORACLE 11g xe (Release 11.2.0.2.0 Production)
JDK: 1.8.0_31
编译器:Eclipse Jee 2019-06
JDBC: 11.2.0.4 release of the Oracle JDBC
需要在登录的用户名后加上字符串"as SYSDBA"
public static String DRIVER_NAME = "oracle.jdbc.driver.OracleDriver";
public static String URL = "jdbc:oracle:thin:@localhost:1521:XE";
public static String USERNAME = "system as SYSDBA";
public static String PASSWORD = "root";
然后进行调用即可:
public static Connection getConnection() {
Connection connection = null;
try {
Class.forName(DRIVER_NAME);
connection = DriverManager.getConnection(URL,USERNAME,PASSWORD);
} catch (ClassNotFoundException e) {
// TODO Aut