Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
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.


SQL
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

Very very thank you in advance.

[Edited]Code is blocked in "pre" tag[/Edited]
Posted
Updated 1-May-11 17:45pm
v2

1 solution

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
 
Share this answer
 
Comments
sushilkumarsingh0 31-Dec-11 1:07am    
bunbuhbnkn

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900