Exception in thread "main" java.sql.SQLException: ORA-28040: 没有匹配的验证协议

一直以来用的都是服务器上的Oracle数据库,今天改成连接本地Oracle 12c数据库是出问题了。hibernate连接Oracle12c时出现
    java.sql.SQLException: ORA-28040: 没有匹配的验证协议。
解决方案:
     在Oracle的安装路径下找到sqlnet.ora文件。(我的安装路径D:\app\product\12.1.0\dbhome_1\network\admin)
 在文件的最后添加SQLNET.ALLOWED_LOGON_VERSION=8就完美解决了;如图:

Exception in thread "main" java.sql.SQLException: ORA-28040: 没有匹配的验证协议

然后运行发现出现新的异常:

Exception in thread "main" java.sql.SQLException: ORA-28009: 应当以 SYSDBA 身份或 SYSOPER 身份建立 SYS 连接

再次查阅------

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

Class.forName("oracle.jdbc.driver.OracleDriver");     

 //连接到数据库
String url="jdbc:oracle:thin:@localhost:1521:orcl";
String username="sys AS SYSDBA";
String password="123456";

Connection conn=DriverManager.getConnection(url,username,password);

//输出conn引用对象的实际类型
System.out.println(conn.getClass());

将用户名的后面加上 as sysdba

ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

Exception in thread "main" java.sql.SQLException: ORA-28040: 没有匹配的验证协议