Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect in java as SYS to Oracle?

I receive this error:

java.sql.SQLException: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER 

How to fix? (I need to be SYS). Thanks.

like image 907
user710818 Avatar asked Apr 11 '12 07:04

user710818


People also ask

What is JDBC URL in Oracle?

A JDBC URL provides a way of identifying a database so that the appropriate driver recognizes it and connects to it. In the Derby documents, a JDBC URL is referred to as a database connection URL.


2 Answers

try this :

import java.sql as jsql import java.lang as lang driver, url, user, passwd = ( "oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@localhost:1234:xxx1", "sys as sysdba", "xxx1")  lang.Class.forName(driver)  c = jsql.DriverManager.getConnection(url,user,passwd) 
like image 165
simplycurious Avatar answered Oct 11 '22 07:10

simplycurious


Answers already there,

you are trying to connect as sys but the Server allows

either

sys as sysdba 

or

sys as sysoper 

just change user parameter as either one from above

user='sys as sysdba' 

or

user='sys as sysoper' 
like image 32
RahulArackal Avatar answered Oct 11 '22 08:10

RahulArackal