[quoted text, click to view] "Jason" <jhsu8999@yahoo.com> wrote in message
news:p1lk60t7c8ehb65v5culkt3882n3lsf5go@4ax.com...
> 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.
>
> 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>
>
You should probably post this in microsoft.public.sqlserver.jdbc to get a
better answer. The only really obvious thing to check from the MSSQL side
would be that the Tracking table actually has data in it.
Simon