This discussion is archived
1 Reply Latest reply: Jul 2, 2013 2:22 PM by rp0428 RSS

jdbc auth to 12c pluggable db?

jhalli Newbie
Currently Being Moderated

What's the JDBC thin connection string format for users defined on a 12c pluggable db rather than the parent container?

 

bash> sqlplus /nolog
SQL> connect myuser@"myhost/PDBORCL"

 

is the native version, but what's the syntax for JDBC?

 

ds.setURL("jdbc:oracle:thin:@myhost:1521:orcl");
ds.setUser("myuser");

 

fails, since it's trying authentication against the container's users, not the pluggable db's users.

 

Documentation seems a bit lacking on the ground, but this must be possible with the right incantation...

 

Thanks

  • 1. Re: jdbc auth to 12c pluggable db?
    rp0428 Guru
    Currently Being Moderated

     

    What's the JDBC thin connection string format for users defined on a 12c pluggable db rather than the parent container?

     

    bash> sqlplus /nolog
    SQL> connect myuser@"myhost/PDBORCL"

     

    is the native version, but what's the syntax for JDBC?

     

    ds.setURL("jdbc:oracle:thin:@myhost:1521:orcl");
    ds.setUser("myuser");

     

    fails, since it's trying authentication against the container's users, not the pluggable db's users.

     

    Documentation seems a bit lacking on the ground, but this must be possible with the right incantation...

     

    Sorry - but documentation is not 'lacking'.

     

    Here is the link to the JDBC Dev Guide for 12c:

    http://docs.oracle.com/cd/E16655_01/java.121/e17657.pdf

     

    Review the section 'Sample: Connecting, Querying, and Processing the Results'

     

    >

    ods.setURL("jdbc:oracle:thin:@//localhost:5221/orcl");

    >

    Simply put the PDB service name after the port number followed by a 'slash'.

     

    And a reminder for anyone planning to try out Oracle 12c: if you do NOT read the documentation first you will have nothing but probems trying to do even simple things such as connect or create a user.

     

    There are TWO types of users in 12c: common users and local users. You will need to know the difference in order to know how to create the type of user you need. And any exceptions you get when doing some of the 'basics' will likely have CDB in their name.

     

    That means you will need to look up the exception (since those didn't exist prior to 12c) and might get referred to one of the *_CDB_* system views (which didn't exist prior to 12c). And you will soon find yourself going back to the docs to try to understand what is happening.

     

    So - just start with the docs: it is much simpler for everyone that way. There is no way for anyone to help you understand what is happening if you haven't been through the docs so there is going to be a lot more RTFM than there ever was before.

     

    12c documentation home page

    http://www.oracle.com/pls/db121/homepage

     

    In particular see chapters 17 and 18 on the new Multitenant Architecture. If you don't read and understand this you will not make much progress in 12c.

     

    http://docs.oracle.com/cd/E16655_01/server.121/e17633/toc.htm