If you wanna using jdbc you should first install maxdb driver for windows
and then using jdbc:odbc to connect to it :
try {
Connection connection = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String serverName = "localhost";
String portNumber = "1521";
String sid = "orcl";
String url = "jdbc:odbc:orcl";
String username = "kunal";
String password = "kunal";
connection = DriverManager.getConnection(url, username, password);
} catch(SQLException se) {
se.printStackTrace();
}