Tuesday, March 22, 2011

JDBC and SQLExpress

Windows XP/ Server 2003

1. Download  apache-tomcat-7.0.11 for Windows
2. Download MS SQL JDBC Driver 3.0
3. Download MS Web Platform Installer
4. Download Java SE 6 (JRE 1.6.24)

Installation:
Install MS SQL 2008 R2 Express Edition and SQL Management Studio using the Web Platform Installer.
Unzip apache-tomcat files to C:\apache-tomcat-7.0.11
Unzip SQL JDBC driver to C:\Program Files\Microsoft SQL Server JDBC Driver 3.0
Install Java SE 6

Set System Enviroment Variables:
Add JRE_HOME=C:\Program Files\Java\jre6
Add Path=C:\Program Files\Microsoft SQL Server JDBC Driver 3.0\sqljdbc_3.0\enu\auth
Verify CLASSPATH=.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip

JDBC Driver:
Copy C:\Program Files\Microsoft SQL Server JDBC Driver 3.0\sqljdbc_3.0\enu\sqljdbc4.jar
to C:\apache-tomcat-7.0.11\lib

SQLExpress:
Enable TCP/IP and set IPAll=1433 (make sure TCP Dynamic Ports is blank). Restart SQL Server Service in SQL Server Configuration Manager.
Set SQL Server Authentication to SQL Server and Windows Authentication Mode in SQL Server Management Studio.

Apache Tomcat:
Start Tomcat by executing batch file C:\apache-tomcat-7.0.11\bin\startup.bat
Open web browser and navigate to http://localhost:8080
Create test.jsp page and copy it to C:\apache-tomcat-7.0.11\webapps\ROOT\


JSP Test Page:




Test Result should be something like this:







This test Tomcat functionality and DB connectivity.

4 comments:

  1. any idea if the output is "Connection failed: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost//MSSQLSERVER2, port 1433 has failed. Error: "null. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port."."

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Hi, Can you explain how to set System Enviroment Variables... i have tried a lot but still i have problem when i use integrated security

    ReplyDelete
  4. Hi, Great job... fantastic :)
    Thanks a lot for sharing useful post with download links.

    Please keep it up :)

    Thanks,
    Mike
    Sql server JDBC Driver

    ReplyDelete