I want to make java code that does only this:
Login to the \'xe\' connection in Oracle 11g database. That\'s all. How can do it ?
EDIT: yes, i was using JDBC,
You should write the following code :
private String driver="oracle.jdbc.driver.OracleDriver";
private String dbURL="jdbc:oracle:thin:@localhost:1521:XE";
private String dbUserName="sys as sysdba";
private String dbPassword="123456";
try{
Class.forName(driver);
con=DriverManager.getConnection(dbURL,dbUserName,dbPassword);
-----//Rest of your Code//-------
}catch(Exception e){
e.printStackTrace();
}
Unfortunately, your answer is a bit too vague.
Overall, look to JDBC. Oracle's documentation of JDBC can be found here.
If you want to connect as SYS you have to use sys as sysdba
So in your java code try like the following code
String url = "jdbc:oracle:thin:@//localhost:1521:xe";
String username = "sys as sysdba";
String password = "123456";
Connection connection= DriverManager.getConnection(url, username, password);
Regards