mysql and mssql in jsp connection
From: Jason (jhsu8999_at_comcast.net)
Date: 03/31/04
- Next message: Michael Scovetta: "Re: How to do "Please wait .....""
- Previous message: javaguy44: "Re: Struts + Servlet Filter + Global Forward problem"
- Next in thread: Tony Morris: "Re: mysql and mssql in jsp connection"
- Reply: Tony Morris: "Re: mysql and mssql in jsp connection"
- Reply: Jason Bell: "Re: mysql and mssql in jsp connection"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Mar 2004 19:53:49 -0700
Hi, all,
I have a simple jsp page which conneced to mysql database with no problem, but
after I changed to production database server, MSSQL, I got nothing returned. I
did changed jdbc drive, etc., please help. Thanks in advance.
<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ page import="java.sql.*" %>
<%
String connectionURL =
"jdbc:microsoft:sqlserver://DBServer:1433/Tracking;User=user;Password=pw";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
String sSQLString="SELECT * FROM Tracking";
%>
<html>
<head>
<title>
Report
</title>
</head>
<body bgcolor="#ffffc0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#CCCCCC"><img src="images/logo.gif" width="175"
height="55"></td>
<td bgcolor="#CCCCCC"><div align="right"><img src="images/logo2.gif"
width="157" height="46"></div>
</td>
</tr>
</table>
<hr>
<table width="100%" border="1">
<% try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
connection = DriverManager.getConnection(connectionURL);
statement = connection.createStatement();
rs = statement.executeQuery(sSQLString);
while (rs.next()) { %>
<tr>
<td><tt><% out.print("FromDate"); %></tt></td>
<td><tt><% out.print("FromTime"); %></td>
</tr>
<% }
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (rs != null) rs.close();
if (statement != null) statement.close();
if (connection != null) connection.close();
} %>
</table>
</body>
</html>
- Next message: Michael Scovetta: "Re: How to do "Please wait .....""
- Previous message: javaguy44: "Re: Struts + Servlet Filter + Global Forward problem"
- Next in thread: Tony Morris: "Re: mysql and mssql in jsp connection"
- Reply: Tony Morris: "Re: mysql and mssql in jsp connection"
- Reply: Jason Bell: "Re: mysql and mssql in jsp connection"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|