How to connect in java as SYS to Oracle?

后端 未结 8 1814
花落未央
花落未央 2020-12-08 07:15

I receive this error:

java.sql.SQLException: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

How to fix? (I need to be SY

8条回答
  •  误落风尘
    2020-12-08 08:11

            /*It works for me*/
            /*also oci and thin is important if you want to connect with database which is installed in your clien (Computer) add oci if you want to install to server add thin*/
    
            String dbURL2 = "jdbc:oracle:oci:@172.16.24.123:1521:XE";
            String username = "sys as sysdba";
            String password = "XX Change it to your system password";
            
            try {
            Connection connection = DriverManager.getConnection(dbURL2, username, password);
                System.out.println("Connected to Oracle data");
            
        } catch (SQLException e) {
                System.out.println("Opps ! error");
                e.printStackTrace();
            
        }
    

提交回复
热议问题