First install the JSP to access the driver of SQL Server 2000:
Download drivers from Microsoft's website: SQL Server 2000 For JDBC driver, in Google, you can search in Google. Then you must use the three JAR files in the LIB directory in the installation directory:
Msbase.jar, mssqlserver.jar, msutil.jar Copy to Tomcat directory under CommON / lib directory. And set ClassPath. Then restart Tomcat.
<% @ Page info = "Database handler"%> <% @ page import = "java.io. *"%> <% @ page import = "java.util. *"%> <% @ page import = "java.sql. *"%> <% @ page import = "javax.servlet. *"%> <% @ Page Import = "javax.servlet.http. *"%> <% class.forname ("com.microsoft.jdbc.sqlser.sqlserverdriver); string url =" JDBC: Microsoft: SQLServer: // localhost: 1433; databasename = database name "; connection conn = drivermanager.getConnection (URL," User Name "," Password "); Statement Stmt = Conn.createStatement (); string query =" Create Table Coffeees " " (COF_NAME VARCHAR (32), " " Sup_ID Integer, " " Price Float, " " SALES INTEGER, " " Total Integer "; // Execute Stmt.executeUpdate (Query);%>