In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use Microsoft JDBC to connect to the database in JSP. It is very detailed and has a certain reference value. Friends who are interested must read it!
1. Install Microsoft JDBC Driver
Needless to say, press "next" to complete the installation.
two。 Configuration
Let's first talk about the role of environmental variables:
JAVA_HOME variable: used to set the directory where the JAVA package is located
TOMCAT_HOME variable: used to set the directory where the TOMCAT server is located
CLASSPATH variable: import some class libraries (such as java.io.*, java.lang.*, etc.) in the compiled java or jsp file. When the compiler javac.exe compiles the java or jsp file, you must know where these libraries are located. So, CLASSPATH is used to set up the java class library
You usually need to set the value in CLASSPATH:% JAVA_HOME%\ lib. After installing Microsoft JDBC Driver, you also need to add:% JDBC_INSTALL_PATH%\ lib\ msbase.jar;%JDBC_INSTALL_PATH%\ lib\ mssqlserver.jar;%JDBC_INSTALL_PATH%\ msutil.jar
Note:% JDBC_INSTALL_PATH% is the directory where Microsoft JDBC Driver is installed. For example, set this environment variable JDBC_INSTALL_PATH = "c:\ program files\ microsoft jdbc driver"
Path variable: used to set the path of java.exe (to execute the compiled class) and javac.exe (to compile the java file to class). For example, you can type javac.exe directly under the dos console without having to change to the directory where javac.exe is located and then execute javac.exe.
3. Keystone
Be sure to remember that after installing Microsoft JDBC, you will install three jar files in the lib directory in the installation directory:
Msbase.jar, mssqlserver.jar, msutil.jar are copied to the common\ lib directory under the Tomcat directory. After that, you must restart Tomcat! The purpose of this is that the jsp page will not be unable to find the sql server driver class library during compilation.
But I really don't understand:% JAVA_HOME%\ lib has been set as the default library path, when I copied the three jar files of Microsoft JDBC Driver: msbase.jar,mssqlserver.jar,msutil.jar into% JAVA_HOME%lib (% JAVA_HOME%\ jre\ lib also tested, and set the corresponding CLASSPATH, the result is the same), and then ran the jsp page, but still prompted that the driver class library could not be found.
Does TOMCAT only recognize class libraries in its own common\ lib directory?
4. JSP code that connects to SQL Server 2000
Your * field is: your second field is: body > html > the above is all the contents of the article "how to connect to the database using Microsoft JDBC in JSP". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.