<%@ page contentType="text/html;charset=GB2312" language="java" %>
<%@ page import="java.sql.*"%>
<html>
<head><title>JDBC-ODBC连接 SQL Server</title></head>
<%
  Connection conn=null;
  try
    {
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       String strConn="JDBC:odbc:shopData";
       String strUser="sa";
       String strPassword="123456";
       conn=DriverManager.getConnection(strConn,strUser,strPassword);
       out.println("<h2>JDBC-ODBC连接数据库成功!<h2>");
     }
  catch(ClassNotFoundException e)
  {
   out.println(e.getMessage());
   }
   catch(SQLException e)
   {
   out.println(e.getMessage());
   }
  finally
  {
   try 
   {
     if(conn!=null)
         conn.close();
    }
    catch(Exception e){}
   }
%>
</html>结果出现:[Microsoft][ODBC 驱动程序管理器] 在指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配