<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import = "java.sql.DriverManager" %>
<%@ page import = "java.sql.Connection" %>
<%@ page import = "java.sql.PreparedStatement" %>
<%@ page import = "java.sql.ResultSet" %>
<%@ page import = "java.sql.SQLException" %>
<%
String connectionURL = "jdbc:mysql://***.***.***.***:3306/IBE?characterEncoding=UTF-8&serverTimezone=UTC";
Connection connection = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String code = request.getParameter("code"); //Code
if(code == null) code="";
String Decode = code;
try{
if(code.length()==2){
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "****user", "*********");
String query ="SELECT airline_code,airline_korean FROM IBE.Airlines where airline_code = ? LIMIT 0, 1";
pstmt = connection.prepareStatement(query);
pstmt.setString(1,code);
rs = pstmt.executeQuery();
while(rs.next()){
Decode = rs.getString("airline_korean");
}
out.println(Decode);
}else
out.println(code);
}
catch(Exception ex){
out.println(ex.toString());
}finally{
if(rs != null) try{rs.close();}catch(SQLException ex){}
if(pstmt != null) try{pstmt.close();}catch(SQLException ex){}
if(connection != null) try{connection.close();}catch(SQLException ex){}
}
%>