Java tutorial
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class Main { public static void main(String[] args) throws Exception { System.setProperty("oracle.net.tns_admin", "C:/app/product/11.2.0/client_1/NETWORK/ADMIN"); String dbURL = "jdbc:oracle:thin:@ENTRY_FROM_TNSNAMES"; Class.forName("oracle.jdbc.OracleDriver"); Connection conn = DriverManager.getConnection(dbURL, "your_user_name", "your_password"); System.out.println("Connection established"); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT dummy FROM dual"); if (rs.next()) { System.out.println(rs.getString(1)); } stmt.close(); conn.close(); } }