Garbled question:
Resin's support for Chinese, almost no settings can also display Chinese normally, and in the Tomcat, you need to set up the Page property under the JSP page: <% @ page contenttype = "text / html; charset = GBK"%>, In order to display Chinese normally; when the return value contains Chinese, you need to set up the character type EXAMPLES: <% Request.setChacTerencoding ("GBK"); // Set to GB2312 can also string foo = Reques.getParameter (" Foo "); // Assume that the value in the foo is Chinese Out.println (foo); // This does not appear to be garbled by this Outprint
JDBC connection problem:
JDBC library is only needed in ClassPath under resin.
Msbase.jar
MSSQLServer.jar
Msutil.jar
The Tomcat is required to copy these three files to Tomcat Home / Common / LIB
can
Test JDBC code: from
http://blog.9cbs.net/kanaima/
JSP file:
<% @ Page ContentType = "text / html; charset = GB2312"%>
<% @ Page Import = "java.sql. *"%>
<%
Class.Forname ("com.microsoft.jdbc.sqlserver.sqlserverdriver). NewInstance ();
String URL = "JDBC: Microsoft: SQLServer: // localhost: 1433; DatabaseName = HaIguan"
String User = "sa";
String password = ""; connection conn = drivermanager.getConnection (URL, User, Password);
Statement Stmt = Conn.createStatement (ResultSet.Type_Scroll_Sensitive, ResultSet.concur_Updata);
String SQL = "SELECT * from XT_USER";
ResultSet RS = Stmt.executeQuery (SQL);
While (rs.next ())
{
%>
Your first field content is: <% = rs.getstring (1)%>
Your second field content is: <% = rs.getstring (2)%>
<%
}
%>
<% out.print ("Database Success, Congratulations");%>
<%
Rs.close ();
Stmt.close ();
CONN.CLOSE ();
%>
body>
html> JDBC driver download: Window operating system
: Http://www.uncj.com/upload/files/ms_JDBC_SETUP.EXE
http://download.microsoft.com/download/3/0/F/30FF65D3-A84B-4B8A-A570-27366B2271D8/Setup.exeunix operating system MSSQLSERVER.TAR
http://download.microsoft.com/download/3/0/F/30FF65D3-A84B-4B8A-A570-27366B2271D8 /MSSQLSERVER.TAR
RESIN and Tomcat download URL: resin: http://www.caucho.com/tomcat: http://www.apache.org