I have a JSP which makes some SQL query to a database and prints them out (code below).
The JSP works great on my Tomcat or Google App Engine localhost server.
But it doesn't work when i upload my WAR to AWS Elastic Beanstalk or Google App Engine server environments. Can you tell me why?
<%@ page language="java" import="java.sql.*,java.util.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Twitter</title>
</head>
<body>
<%
Class.forName ("org.postgresql.Driver");
Connection postgresConnection = DriverManager.getConnection ("jdbc:http://postgresql*****/Twitter",
"postgres", "****");
String query = new StringBuilder().append("SELECT * from tswholeworld").toString();
PreparedStatement ps = postgresConnection.prepareStatement(query);
ResultSet rs = ps.executeQuery();
StringBuilder stringBuilder = new StringBuilder();
while(rs.next()) {
String lat = rs.getString(3);
String lon = rs.getString(4);
stringBuilder.append("new google.maps.LatLng("+lat+", "+lon+"), ");
}
String finalString = stringBuilder.toString();
%>
<%=finalString%>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire