From MySQL to MSSQL

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jason (jhsu8999_at_yahoo.com)
Date: 03/31/04


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>



Relevant Pages

  • mysql and mssql in jsp connection
    ... after I changed to production database server, MSSQL, I got nothing returned. ... Connection connection = null; ... Statement statement = null; ...
    (comp.lang.java.programmer)
  • MSSQL 2000 Developer connection limit & boolean connection
    ... I've been searching the MSDN web for the MSSQL 2000 Developer connection ... We do have user connecting to this database through http/asp, ...
    (microsoft.public.sqlserver.connect)
  • Re: How to prevent connection string from being public?
    ... >I'm using a MySQL database from within some Perl cgi's. ... >make the connection, I have to supply the username/password ... I can't have my own webserver, ... it in either the script or in a config file. ...
    (comp.lang.perl.misc)
  • Re: Difference between storing files on folder and in mysql db
    ... a separate instance of an image display script (and a separate ... connection to the DB server) to display each image. ... connection if images were stored in the file system. ... mySQL database or if I should just store the files in a dedicated ...
    (comp.lang.php)
  • Re: [PHP] ODBC and long text fields
    ... MSSQL specific php extension? ... better/faster connection to the MSSQL server as well as making the issue go ... MSSQL functions still require an ODBC driver underneath, ...
    (php.general)