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 SY
Are you able to use an OracleDataSource Object?
public class Database {
static OracleDataSource ods;
public static Connection openConnection(String URL, String user, String password, String option) throws SQLException
{
Connection conn = null;
Properties properties = new Properties();
properties.put("user", user);
properties.put("password", password);
ods = new OracleDataSource();
ods.setURL(URL);
if(option != null)
{
properties.put("internal_logon", option);
}
ods.setConnectionProperties(properties);
conn = ods.getConnection();
return conn;
}
}
And call it like this:
Connection con = null;
con = Database.openConnection("YourJDBCConnectionURL", "YourSYSUser", "YourSYSPassword", "sysdba");