Skip to content

Instantly share code, notes, and snippets.

@devheedoo
Created December 12, 2016 08:44
Show Gist options
  • Save devheedoo/6c73ef370bb461dded4474fe9844c6a7 to your computer and use it in GitHub Desktop.
Save devheedoo/6c73ef370bb461dded4474fe9844c6a7 to your computer and use it in GitHub Desktop.
Test oracle connection
<%@ page contentType="text/html; charset=EUC-KR" %>
<%@ page import="java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR" />
<title>Oracle Connection Test</title>
</head>
<body>
<h1>Oracle Connection Text</h1>
<%
String res = "";
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@ipAddress:1521:serviceName";
Connection conn = DriverManager.getConnection(url, "id", "pw");
if (conn != null) {
res = "Connection success!";
}
} catch (Exception e) {
res = "Connection fail: " + e;
}
%>
<p><%=res %></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment