간단한 응용 프로그램을 배포하기 위해 AWS 도구를 사용하고 있습니다.Amazon Web Services - RDS Configuration
저는 RDS 인스턴스 (Oracle)를 가지고 있으며 작동 중입니다. (로컬 컴퓨터의 SQL Developer에서 액세스 할 수 있습니다.)
다른면에서 필자는 Eclipse에서 jsp의 간단한 애플리케이션을 작성하여 Oracle 인스턴스 (위의 metioned)에있는 테이블을 반복하고 화면. 이 응용 프로그램은 아파치 톰캣 서버 (로컬 호스트)에 배치되면
TEST.JSP
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="dbconnection.DataSource"%>
<%@page import="java.sql.*"%>
<%@page import="oracle.jdbc.pool.OracleDataSource"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Tercera Prueba</title>
</head>
<body>
<%
DataSource ods = new DataSource();
Connection conn=ods.connect();
out.println (ods.getUserName(conn));
// Close the connection
conn.close();
conn = null;
%>
</body>
</html>
DataSource.java는
import oracle.jdbc.pool.OracleDataSource;
public class DataSource
{
public String getUserName(Connection conn)
throws SQLException
{
// Create a Statement
Statement stmt = conn.createStatement();
String str="";
// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQuery ("select USER from dual");
// Iterate through the result and print the employee names
while (rset.next())
str= "User name is " + rset.getString (1);
// Close the RseultSet
rset.close();
rset = null;
// Close the Statement
stmt.close();
stmt = null;
return (str);
}
public Connection connect() throws SQLException{
// Create a OracleDataSource instance explicitly
OracleDataSource ods = new OracleDataSource();
// Set the user name, password, driver type and network protocol
ods.setDriverType("thin");
ods.setServerName("xxxxxx");
ods.setDatabaseName("oracledb");
ods.setPortNumber(1521);
ods.setUser("xxxxxx");
ods.setPassword("xxxxxxx");
Connection conn = ods.getConnection();
return (conn);
}
}
, 모든 작품을 좋아하고, 값이 화면에 표시됩니다.
그러나, 한 번이 응용 프로그램은 (이클립스 AWS 툴킷을 사용하여) 탄성 콩 줄기 서비스를 통해 배포, 웹 페이지 로딩 시간이 오래 걸립니다, 그리고 마지막으로 아무것도 (빈 페이지)를 나타나지 않습니다. 사실, 오류도 표시되지 않습니다.
것은 내가 라인으로 라인을 디버깅하고, 모든 것이 잘 라인 전까지 간다 :
Connection conn=ods.connect();
내가 내 RDS 오라클 인스턴스의 구성과 관련된 뭔가 생각합니다. 그러나 확실하지 않은 Im. 그것이 어떻게 구성되어 있습니다.
당신이 어떤 생각을 가지고 있습니까?많은 감사
연결 방법에서 숨겨진 서버 이름이 이미지의 끝점과 같습니까? 연결 시도가 시간 초과되거나 다른 오류가 발생합니까? 첫 번째 생각은 방화벽 문제처럼 들리지만 JSP를 호스팅하는 AWS 인스턴스에서 아웃 바운드해야합니다. –
예. 서버 이름은 이미지의 끝점과 동일합니다. 내가 실행할 때 오류가 없으며 그냥 aprox가 필요합니다. 1 분 후에 빈 페이지가 표시됩니다. 마지막 질문에 대답하려고하면 예, 이해합니다. 사용자, 패스, 호스트, 포트, db 이름을 지정하여 RDS Oracle 인스턴스에 연결할 수 있습니다. 로컬 컴퓨터에서 데이터베이스 (usiing Apache Tomcat) – Lev