2. Run C:\mysql\bin\winmysqladmin, enter username, password
If you do not have this service: Open the Run input c:\mysql\bin\mysqld-nt.exe–install. Then open the Administrative Tools-> Service, locate the MySQL service, and start it. Restart Windows2000.
====================================================================
If you do not need a JSP, install to this completion.
The following starts installing the JSP ====================================================================
Iv. installation of related software
1. Download a JDK (j2sdk-1_4_0-win.exe), assuming the installation is C:\J2SDK.
2, download resin for Windows version (2.1.6 version),
Address: http://www.caucho.com/download/, solution ... Resin\bin\httpd-install ", perform" C:\Resin\bin\httpd-remove "at the command line if you want to remove the Resin service from the system service.
3, download JDBC for MySQL
File name is Mm.mysql-2.0.14-bin.jar
Copy to C:\Resin\lib directory (for JSP to support MySQL).
----------------------------
V. Configure environment variables
My Computer right mouse button-> Properties-> advanced-> environment variable-> system variable bar
1, Java_home
Click "New ...", the variable Name column fills in "Java_home", the Variable Value column fills in "C:\j2sdk", click "OK".
2, Resin_home
Creates a new variable "Resin_home" with a value of "C:\resin".
3, CLASSPATH
In the system variable column find Classpath, click "Edit ...", if there is no this variable, click "New ...", after the value of the variable plus c:\j2sdk\lib\tools.jar;c:\j2sdk\lib\dt.jar; ", click OK."
Test Service:
Execution: http://localhost:8080 can see some environment variables for the current resin server.
---------------------------
Six, configure Apache bundle resin,
Execute C:\resin\bin\setup.exe
Selecting the Apache2 service automatically adds the content required for the C:\Apache\conf\httpd.conf file.
or open C:\Apache\conf\httpd.conf, add at the end
LoadModule caucho_module "C:/resin/libexec/apache-2.0/mod_caucho.dll"
<ifmodule mod_caucho.c>
Cauchoconfigfile "C:/resin/conf/resin.conf"
<Location/caucho-status>
SetHandler Caucho-status
</Location>
</IfModule>
Modify Resin configuration file c:\Resin\conf\Resin.conf
Find this line:<doc-dir>doc</doc-dir>
Change into:<doc-dir>c:/apache2/htdocs</doc-dir>
--------------------------
Create a new file test.jsp in the C:\Apache\htdocs\ directory, which reads as follows:
2+2=<=2+2>
Run http://localhost/test.jsp display in browser: 2+2=4
Description Apache+resin configuration complete.
-------------------------
To test the MySQL connection:
Suppose the MySQL database species to build a database MySQL, table name is User
Create a new file test-mysql.jsp in the C:\Apache\htdocs\ directory, which reads as follows:
<% @page language= "java" import= "java.sql.*" contenttype= "text/html"; charset=gb2312 "%>
<%
String ls_username = "root"; Database user Name
String Ls_password = "xxxxxx"; Password
String ls_server = "localhost";
String ls_dbname = "MySQL"; Database name
Connection con = null;
Try
{
Registering JDBC Connection drivers
Class.forName ("Org.gjt.mm.mysql.Driver");
Establishing a connection to the database
con = drivermanager.getconnection ("jdbc:mysql://" +ls_server+ "/" +ls_dbname,ls_username,ls_password);
}
catch (Exception e)
{
System.out.println (E.tostring ());
}
%>
<title> Test Database Connection </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<body bgcolor= "#FFFFFF" text= "#000000" >
<%
int li_count = 0;
String ls_sql = "SELECT count (*) from user"; Name of data table
Try
{
Statement Stmt = Con.createstatement ();
ResultSet rs = stmt.executequery (ls_sql);
if (Rs.next ())
Li_count = Rs.getint (1);
if (Rs!= null)
Rs.close ();
if (Stmt!= null)
Stmt.close ();
}
catch (Exception e)
{
Out.println ("<br>2" + e.tostring () + "<br>");
}
OUT.PRINTLN ("Total" + Li_count +) record <p> Test success! ");
%>
</body>
<%
Try
{
if (Con!= null)
Con.close ();
}
catch (SQLException Sqle)
{
System.out.println (Sqle.tostring ());
}
%>
If the access test.jsp can access the database, it is OK.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.