I have the following code snippet. I have tried all the possible things mentioned on StackExchange but am unable to spot the error in my code.
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8" />
<title>Twitter Mapper</title>
<link rel="stylesheet" href="styles/styles.css">
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
</head>
<body>
<br />
<br />
<div id="map-canvas" align="center"></div>
<script src="scripts/heatmap.js"></script>
<script src="scripts/gmaps-heatmap.js"></script>
<script>
window.onload = (function() {
alert("hi");
// map center
var myLatlng = new google.maps.LatLng(25.6586, -80.3568);
// map options,
var myOptions = {
zoom : 3,
center : myLatlng
};
// standard map
map = new google.maps.Map(document.getElementById("map-canvas"), myOptions);
// heatmap layer
heatmap = new HeatmapOverlay(map, {
// radius should be small ONLY if scaleRadius is true (or small radius is intended)
"radius" : 2,
"maxOpacity" : 1,
// scales the radius based on map zoom
"scaleRadius" : true,
// if set to false the heatmap uses the global maximum for colorization
// if activated: uses the data maximum within the current map boundaries
// (there will always be a red spot with useLocalExtremas true)
"useLocalExtrema" : true,
// which field name in your data represents the latitude - default "lat"
latField : 'lat',
// which field name in your data represents the longitude - default "lng"
lngField : 'lng',
// which field name in your data represents the data value - default "value"
valueField : 'count'
});
});
function populateMap() {
Connection conn = null;
Statement stmt = null;
ResultSet rset = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:8889/mysql",
"", "");
stmt = conn.createStatement();
// dynamic query
rset = stmt.executeQuery ("SELECT * FROM tweets");
//return (formatResult(rset));
} finally {
if (rset!= null) rset.close();
if (stmt!= null) stmt.close();
if (conn!= null) conn.close();
}
};
</script>
</body>
</html>
The line for the error is shown to be as the first line in function populateMap(). Please help.