How do I login to 'xe' connection in Oracle 11g with java code?

前端 未结 3 1060
北荒
北荒 2021-01-21 17:02

I want to make java code that does only this:

Login to the \'xe\' connection in Oracle 11g database. That\'s all. How can do it ?

EDIT: yes, i was using JDBC,

3条回答
  •  情书的邮戳
    2021-01-21 17:26

    If you want to connect as SYS you have to use sys as sysdba

    So in your java code try like the following code

        String url = "jdbc:oracle:thin:@//localhost:1521:xe";
        String username = "sys as sysdba";
        String password = "123456";
    Connection connection= DriverManager.getConnection(url, username, password);
    

    Regards

提交回复
热议问题