In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Steps:
1. Download apache-tomcat-5.5.17.zip and apache-tomcat-5.5.17-admin.zip, the server and management tools, respectively
Uninstall the original 5.0
Extract the admin package to the tomcat5.5 directory and overwrite it to the tomcat5.5 directory, which solves the embarrassment that there is no admin management interface in the past.
two。 Modify the tomcat settings in MyEclipse5.5 to specify the installation directory and the jdk directory
3. Modify the path of the tomcat of the environment variable
4. Configure the Tomcat user, open E:myserverapache-tomcat-5.5.20conf omcat-users.xml, modify the content as shown below, and save it:
-
5. Prepare the jdbc driver for mysql for the tomcat server, download mysql-connector-java-5.0.4.zip, decompress and copy the mysql-connector-java-5.0.4-bin.jar driver file to E:myserverapache-tomcat-5.5.20commonlib
6. Configure database connection pool
There are two ways to start tomcat: one is to enter the directory E:myserverapache-tomcat-5.5.20in and double-click to run the startup.bat file, and the other is to go from the command line window to E:myserverapache-tomcat-5.5.20in, run the command: catalina start, and then back up the E:myserverapache-tomcat-5.5.20confserver.xml file.
Start tomcat in MyEclipse
Visit the management page of tomcat, open the browser and enter http://127.0.0.1:8080, then click the Tomcat Administration link on the left, and then a login page appears. Enter the user name and password as root and pass respectively, go to the management page, and configure datasource:
Save and submit and find that the following is added to the omcat5.5confserver.xml file
Name= "jdbc/abc"
Type= "javax.sql.DataSource"
DriverClassName= "com.mysql.jdbc.Driver"
Password= "1"
MaxIdle= "2"
MaxWait= "5000"
Username= "root"
Url= "jdbc:mysql://127.0.0.1:3306/abc"
MaxActive= "4" / >
Copy this content into omcat5.5confcontext.xml
7. The important thing is that there is another one: copy the dt.jar and tools.jar under jdklib to omcat5.5commonlib.
8. Write program verification:
Public Connection getConn () {
Connection conn = null
Try
{
/ / initialize the lookup namespace
Context ctx = new InitialContext ()
/ / find DataSource
DataSource ds = (DataSource) ctx.lookup ("java:comp/env/jdbc/abc")
Conn = ds.getConnection ()
}
Catch (NamingException e)
{
System.out.println ("NamingException:" + e)
}
Catch (Exception e)
{
System.out.println (e)
}
Return conn
}
Public void clearConn (Connection con) {
Try {
If (con! = null & &! con.isClosed ()) {
Con.close ()
Con = null
}
} catch (Exception e) {
E.printStackTrace ()
}
}
Call in jsp to restart tomcat,OK.
[@ more@]
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.