From MySQL to MSSQL
From: Jason (jhsu8999_at_yahoo.com)
Date: 03/31/04
- Next message: Alin Sinpalean: "Re: Windows based authentication?"
- Previous message: Bill B: "Issue connecting through firewall using jdbc connector."
- Next in thread: Carb Simien [MSFT]: "RE: From MySQL to MSSQL"
- Reply: Carb Simien [MSFT]: "RE: From MySQL to MSSQL"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 30 Mar 2004 22:21:36 -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,
nothing displayed on web browser. I did changed jdbc drive, etc., please help.
Thanks in advance.
For example:
in MySQL:
--------------------------
20040301 010203
in MSSQL
--------------------------
<%@ 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">
<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: Alin Sinpalean: "Re: Windows based authentication?"
- Previous message: Bill B: "Issue connecting through firewall using jdbc connector."
- Next in thread: Carb Simien [MSFT]: "RE: From MySQL to MSSQL"
- Reply: Carb Simien [MSFT]: "RE: From MySQL to MSSQL"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|