Is there a way to add a specific Role to when connecting to an Oracle DB via JBDC
up vote
1
down vote
favorite
I'm trying to use Java to connect to an Oracle DB with ASM. I want to query ASM specific metrics. However, I can only access it with the "sysasm"
role.
Here are a couple of examples of my URLs:
connectionUrl: "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=*host*)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
connectionUrl: "jdbc:oracle:thin:"sys/*password* as sysasm"@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
connectionUrl: "jdbc:oracle:thin:@*host*:1521:+ASM1"
I took a look in the docs but I couldn't see anything about roles and the connection string.
oracle
add a comment |
up vote
1
down vote
favorite
I'm trying to use Java to connect to an Oracle DB with ASM. I want to query ASM specific metrics. However, I can only access it with the "sysasm"
role.
Here are a couple of examples of my URLs:
connectionUrl: "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=*host*)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
connectionUrl: "jdbc:oracle:thin:"sys/*password* as sysasm"@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
connectionUrl: "jdbc:oracle:thin:@*host*:1521:+ASM1"
I took a look in the docs but I couldn't see anything about roles and the connection string.
oracle
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm trying to use Java to connect to an Oracle DB with ASM. I want to query ASM specific metrics. However, I can only access it with the "sysasm"
role.
Here are a couple of examples of my URLs:
connectionUrl: "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=*host*)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
connectionUrl: "jdbc:oracle:thin:"sys/*password* as sysasm"@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
connectionUrl: "jdbc:oracle:thin:@*host*:1521:+ASM1"
I took a look in the docs but I couldn't see anything about roles and the connection string.
oracle
I'm trying to use Java to connect to an Oracle DB with ASM. I want to query ASM specific metrics. However, I can only access it with the "sysasm"
role.
Here are a couple of examples of my URLs:
connectionUrl: "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=*host*)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
connectionUrl: "jdbc:oracle:thin:"sys/*password* as sysasm"@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
connectionUrl: "jdbc:oracle:thin:@*host*:1521:+ASM1"
I took a look in the docs but I couldn't see anything about roles and the connection string.
oracle
oracle
edited Nov 13 at 7:01
Dmitry Demin
786139
786139
asked Nov 12 at 18:31
Ryan Plummer
83
83
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
The "as sysasm" should be applied to the user:
"jdbc:oracle:thin:"sys as sysasm/*password*"@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
add a comment |
up vote
0
down vote
public void connect() throws Exception {
String connectString;
Class.forName("oracle.jdbc.driver.OracleDriver");
connectString = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=*host*)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
System.out.println("Before DriverManager.getConnection");
try {
connection = DriverManager.getConnection(connectString, "sys as sysasm", "password_for_sys");
System.out.println("Connection established");
connection.setAutoCommit(false);
} catch (Exception e) {
// TODO: handle exception
System.out.println("Exception inside connect(): " + e);
e.printStackTrace();
}
}
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The "as sysasm" should be applied to the user:
"jdbc:oracle:thin:"sys as sysasm/*password*"@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
add a comment |
up vote
0
down vote
The "as sysasm" should be applied to the user:
"jdbc:oracle:thin:"sys as sysasm/*password*"@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
add a comment |
up vote
0
down vote
up vote
0
down vote
The "as sysasm" should be applied to the user:
"jdbc:oracle:thin:"sys as sysasm/*password*"@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
The "as sysasm" should be applied to the user:
"jdbc:oracle:thin:"sys as sysasm/*password*"@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
answered Nov 13 at 7:06
Mureinik
175k21125192
175k21125192
add a comment |
add a comment |
up vote
0
down vote
public void connect() throws Exception {
String connectString;
Class.forName("oracle.jdbc.driver.OracleDriver");
connectString = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=*host*)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
System.out.println("Before DriverManager.getConnection");
try {
connection = DriverManager.getConnection(connectString, "sys as sysasm", "password_for_sys");
System.out.println("Connection established");
connection.setAutoCommit(false);
} catch (Exception e) {
// TODO: handle exception
System.out.println("Exception inside connect(): " + e);
e.printStackTrace();
}
}
add a comment |
up vote
0
down vote
public void connect() throws Exception {
String connectString;
Class.forName("oracle.jdbc.driver.OracleDriver");
connectString = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=*host*)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
System.out.println("Before DriverManager.getConnection");
try {
connection = DriverManager.getConnection(connectString, "sys as sysasm", "password_for_sys");
System.out.println("Connection established");
connection.setAutoCommit(false);
} catch (Exception e) {
// TODO: handle exception
System.out.println("Exception inside connect(): " + e);
e.printStackTrace();
}
}
add a comment |
up vote
0
down vote
up vote
0
down vote
public void connect() throws Exception {
String connectString;
Class.forName("oracle.jdbc.driver.OracleDriver");
connectString = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=*host*)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
System.out.println("Before DriverManager.getConnection");
try {
connection = DriverManager.getConnection(connectString, "sys as sysasm", "password_for_sys");
System.out.println("Connection established");
connection.setAutoCommit(false);
} catch (Exception e) {
// TODO: handle exception
System.out.println("Exception inside connect(): " + e);
e.printStackTrace();
}
}
public void connect() throws Exception {
String connectString;
Class.forName("oracle.jdbc.driver.OracleDriver");
connectString = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=*host*)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=+ASM)(INSTANCE_NAME=+ASM1)(UR=A)))"
System.out.println("Before DriverManager.getConnection");
try {
connection = DriverManager.getConnection(connectString, "sys as sysasm", "password_for_sys");
System.out.println("Connection established");
connection.setAutoCommit(false);
} catch (Exception e) {
// TODO: handle exception
System.out.println("Exception inside connect(): " + e);
e.printStackTrace();
}
}
answered Nov 13 at 7:13
Dmitry Demin
786139
786139
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53268086%2fis-there-a-way-to-add-a-specific-role-to-when-connecting-to-an-oracle-db-via-jbd%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown