js|mysql| Insert | solve | data | database
The JSP page is guaranteed to be GBK code with the following 3 sentences
<%@ page session= "true"%>
<%@ page contenttype= "TEXT/HTML;CHARSET=GBK"%>
<% @page pageencoding= "GBK"%>
<%request.setcharacterencoding ("GBK");%>
The database connection uses the following statement
String sConnStr = "jdbc:mysql://localhost:3306/test?user=michael&password=123456&useunicode=true& CHARACTERENCODING=GBK ";
and the contents of the My.ini in MySQL are as follows
Basedir=d:/mysql
#bind-address=127.0.0.1
Datadir=d:/mysql-data/data
Default_character_set=gbk
#language =d:/mysql/share/your Language Directory
#slow Query log#=
#tmpdir #=
#port =3306
#set-variable=key_buffer=16m
[Winmysqladmin]
Server=d:/mysql/bin/mysqld-nt.exe
User=michael
Password=123
[Client]
Default_character_set=gbk
The parameters passed between the Read JSP pages appear normal on the page
After inserting data under the DOS command line, the display is normal
One of the INSERT statements is as follows:
<jsp:usebean id= "Reg" scope= "page" class= "Test.chatreg"/>
String strsql= "INSERT into Chatreg (username, password, email, homepage)
VALUES (' + Regname + "', '" + Regpassword + "', '" + Regemail + "', '" + Reg Homepage + "')";
Reg.executequery (strSQL);