如何使用JDBC连接进行SYSDBA登录? [英] How to use the JDBC connection for SYSDBA login?

查看:395
本文介绍了如何使用JDBC连接进行SYSDBA登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我正在使用JDBC代码来连接到Oracle数据库,以用于DBA.我张贴了将在项目中使用的部分代码.我正在Netbeans 6.9中开发应用程序.
在我的项目中,连接将通过移动连接到数据库,因此它是到数据库的远程连接.
在这种情况下,通过使用此代码,我只能像其他用户一样以简单的系统用户身份登录.谁能告诉我如何更改代码,以便我可以登录SYSDBA!
没有此SYSDBA或SYSOPER角色,我将无法使用DBA的备份选项.
请告诉我一些修改或任何其他方式来解决这种情况.


In my project I am using JDBC code for connection to Oracle database for DBA purpose. I posted the part of code which I am going to used in project. I am developing the application in Netbeans 6.9.
In my project connection will be connected to Database through mobile so it is remote connection to database.
here I got situation, by using this code I can only login as simple System user like other user. Can anybody tell me the how I change the code so that I can get SYSDBA login!
without this SYSDBA or SYSOPER role I can''t use DBA''s backup option.
Please Tell me some modification or any other way to solve this situation.


String driver="jdbc:oracle:thin:";
String connStr="@"+Address+":"+port+":"+SID;
public Connection Connect(String UserName,String Password){
try{
if(checkLogin(UserName, Password)){
Class.forName("oracle.jdbc.OracleDriver").newInstance();
// Load the JDBC driver
    java.sql.DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
        //System.out.println(driver+UserName+"/"+Password +connStr);
        return java.sql.DriverManager.getConnection (driver+UserName+"/"+Password +connStr);
}
else
    return null;
}catch(Exception e){
            System.out.println("Error: " +e.getMessage());
            return null;
        }
}


维沙尔·科尔卡(Vishal Kolekar)

非常非常感谢您.

[已编辑]代码在前置"标记中被阻止[/已编辑]


Vishal Kolekar

Very very thank you in advance.

Code is blocked in "pre" tag[/Edited]

推荐答案

This looks like it''s worth a try[^]

to me it''s more about permissions on a Oracle-DB. PLease do a little research, there seems to be different ways to login as sysdba on the different versions of OracleDBs.

regards
Torsten


这篇关于如何使用JDBC连接进行SYSDBA登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆