0

I am trying to connect oracle9i using jdbc (ojdbc5.jar and ojdbc6.jar). But jdbc connection string is not appending as sysdba at the end of connection string.

But when i do same thing using oracle10/11, It works fine.

This is connection string for 9i

jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.168.1.123)(PORT = 1521)))(CONNECT_DATA = (SRVR=DEDICATED) (SID = abcd)))

Please help me to solve the issue.

Thanks, Anjali

Ravi.
  • 674
  • 2
  • 9
  • 21
Anjali
  • 1,623
  • 5
  • 30
  • 50
  • Look at http://stackoverflow.com/questions/10101517/how-to-connect-in-java-as-sys-to-oracle –  Apr 29 '14 at 10:05

2 Answers2

0

you can try this:

Properties props;
Connection connection;

props = new Properties();
props.put("user", xxxx);
props.put("password", "yyyy");
props.put("internal_logon", "sysdba");
props.put("v$session.osuser", System.getProperty("user.name").toString());

//if you are using service
connection = DriverManager.getConnection("jdbc:oracle:thin:@your_host:your_port/your_service, props);
//or if you are using sid
connection = DriverManager.getConnection("jdbc:oracle:thin:@your_host:your_port:your_service, props);
CompEng
  • 7,161
  • 16
  • 68
  • 122
0

Issue is with ojdbc jar.....Please put the ojdbc5.jar in classpath and try.

Anjali
  • 1,623
  • 5
  • 30
  • 50