mysql and mssql in jsp connection

From: Jason (jhsu8999_at_comcast.net)
Date: 03/31/04


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>



Relevant Pages

  • From MySQL to MSSQL
    ... I have a simple jsp page which conneced to mysql database with no problem, ... after I changed to production database server, MSSQL, I got nothing returned, ... Connection connection = null; ...
    (microsoft.public.sqlserver.jdbcdriver)
  • 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: [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)
  • MSSQL 2005 Remote Connections
    ... I have an XP pro machine, that I have MSSQL 2005 installed. ... I have a fixed ip for my internet connection, ... router, where the ports 1040 1433 1434 are forwarded from the router ... to the mssql server machine. ...
    (microsoft.public.sqlserver.setup)
  • Connection Drop..
    ... the connection is always drop when i pump in a huge data ... such as 5000 records in the MSSQL database. ... establishing socket. ...
    (microsoft.public.windows.server.sbs)