Home » Developer & Programmer » JDeveloper, Java & XML » I get a SQLException, when trying to connect to oracle 10g xe in java(NetaBeans IDE 6.1) (10g Express Edition)
I get a SQLException, when trying to connect to oracle 10g xe in java(NetaBeans IDE 6.1) [message #386381] Sat, 14 February 2009 03:08 Go to next message
turkuaz07
Messages: 4
Registered: February 2009
Junior Member
Hi everyone....
I imported the ojdbc14.jar into the library and tried to connect to the Oracle 10g.


Connection con;
String className="oracle.jdbc.driver.OracleDriver";
public void baglanti() {
try {
Class.forName(className);
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","hr","hr");
con.close();

System.out.println("bağlantı tamamdır koç..");
} catch (SQLException e) {
System.out.println("SQL Exception: " + e.toString());
} catch (ClassNotFoundException cE) {
System.out.println("Class Not Found Exception: " + cE.toString());
}
--As you see my code,it works
but when ı changed line: "DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","sys","1");"
it doesnt work.

because my username is "sys" and my password is "1".


can anybody help me???


}
Re: I get a SQLException, when trying to connect to oracle 10g xe in java(NetaBeans IDE 6.1) [message #386382 is a reply to message #386381] Sat, 14 February 2009 03:23 Go to previous messageGo to next message
Michel Cadot
Messages: 58901
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
"It doesn't work" is NOT an Oracle message.
Hello doc, I'm sick, can you help me? Are you sure this is enough for doc to help you?

I bet your message was (if you really gave the correct password):
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

And the answer is:
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
 *Cause:    connect SYS/<password> is no longer a valid syntax
 *Action:   Try connect SYS/<password> as SYSDBA or
            connect SYS/<password> as SYSOPER

Regards
Michel

[Updated on: Sat, 14 February 2009 03:24]

Report message to a moderator

Re: I get a SQLException, when trying to connect to oracle 10g xe in java(NetaBeans IDE 6.1) [message #386388 is a reply to message #386382] Sat, 14 February 2009 05:10 Go to previous messageGo to next message
turkuaz07
Messages: 4
Registered: February 2009
Junior Member
yes you are right.it is not oracle message.it belongs to netbeans.
but what is the solution.

my editor(netbeans) says "SQL Exception: java.sql.SQLException: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER".
what am ı gonna do.Because it is true that my username is sys and my password is "1".As we see in the error message it doesnt accept mines.But it accepts username="hr" password="hr".
Re: I get a SQLException, when trying to connect to oracle 10g xe in java(NetaBeans IDE 6.1) [message #386402 is a reply to message #386388] Sat, 14 February 2009 09:12 Go to previous message
Michel Cadot
Messages: 58901
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Read again what I posted, I already answered this.

Regards
Michel
Previous Topic: Binding variable for DBMS_SPM.NAME_LIST in OracleCallableStatement
Next Topic: Deployment Application To Weblogic Server Failed
Goto Forum:
  


Current Time: Wed Aug 27 04:15:08 CDT 2014

Total time taken to generate the page: 0.11063 seconds