Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2004
    Posts
    9

    Unanswered: Problems logging in as sysdba through using JDBC

    Good morning/day/night,

    I have been trying to login as sysdba thu the jdbc, using the extended properties (internal_logon) for the purpose of accessing the dba_users table so that I can retrieve a list of database users. Enterprise manager Console allows me to log on as sysdba but when connecting thru the JDBC I get :
    invalid username/password; logon denied
    but if I comment out the "interanl_logon" property I can connect. My code is as follows:
    Properties pty = new java.util.Properties();
    pty.put ("user", username);
    pty.put ("password", password);
    pty.put ("internal_logon","sysdba");
    connection = java.sql.DriverManager.getConnection(URL,pty);

    Oracle : 9.02010
    JDBC : ojdbc14.jar

    Is there maybe some priviledges that I need to add to login for a JDBC connection that is some how enabled when I connect thru?? The main reason for trying to logon as sysdba is to access the dba_users table: Is there a way of accessing this table without connecting as sysdba or is there another method for get a list of users through the JDBC.

    Thanks in advance...

    S

    Have a great weekend.. ;-o

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    why not grant access to the table to all users or a specific user?
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Jul 2003
    Posts
    2,296
    followup:

    grant this role to any user to see data dictionary tables:
    SELECT_CATALOG_ROLE
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  4. #4
    Join Date
    Sep 2003
    Location
    Virginia, USA
    Posts
    246
    Dude, there is absolutely no reason to connect as SYSDBA to do that! SYSDBA is the person who restarts the database and performs a few other restricted tasks. Any regular DBA can see the table you mentioned. Example, "GRANT DBA TO MARK" and then Mark can logon (regular, no special "internal logon" required) and query the DBA views.
    MarkRem
    Author, Oracle Database 10g: From Nuts to Soup
    http://www.remidata.com/book_nuts2soup.htm

  5. #5
    Join Date
    Feb 2004
    Posts
    9

    Talking Thankx

    Thank you very much... problem solved!!!

    Sheldon
    Last edited by sdamons; 08-30-04 at 03:43. Reason: Want to thank both replied users

  6. #6
    Join Date
    Oct 2010
    Posts
    2

    problem not solved for me

    Hello,

    sorry for "warming up" this old thread, but I didn't find a solution for my problem, which is really similar to this thread.

    I'd like (I need) to create a JDBC connection to my Oracle 10.2g using Java 6.0 as sysdba. In the Internet, I found this nice code for it:

    Code:
    Properties conProps = new Properties();
    conProps.put("user", user);
    conProps.put("password", oraclePasswd);
    conProps.put("internal_logon", "sysdba"); //doesn't work
    
    Connection conn = DriverManager.getConnection(url, user, oraclePasswd);
    When I leave away the line with "internal_logon", it works fine. I get the connection and can work - as normal user. As soon as I add this line, it always returns "ORA-01017: invalid username/password; logon denied". Also logging into Oracle using sqlplus works fine, even using the keyword "AS SYSDBA".

    I can't use the normal user, as I have to give execute permissions on DBMS_FLASHBACK for the regular db user. Also I can't call sqlplus using Java, as the position of sqlplus may be on another machine.

    Thanks a lot for your help in advance!
    Michael

  7. #7
    Join Date
    Oct 2010
    Posts
    2
    After having implemented a workaround, we finally found the problem why it was not possible to connect as SYSDBA. You must use "sys" as user, not the regular database user. This is only possible in sqlplus, but not in JDBC (brilliant):
    Code:
    conProps.put("user", "sys");
    Enjoy!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •