- 论坛徽章:
- 0
|
sybase链接程序编译通过,移植到JSP的问题(已解决)
数据库在unix的机器上
package jsp.dxpt;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
public class login_in_1 extends org.apache.jasper.runtime.HttpJspBase {
static {
}
public login_in_1( ) {
}
private boolean _jspx_inited = false;
public final synchronized void _jspx_init() throws org.apache.jasper.JasperException {
if (! _jspx_inited) {
_jspx_inited = true;
}
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
String _value = null;
try {
try {
_jspx_init();
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=gb2312" ;
pageContext = _jspxFactory.getPageContext(this, request, response,
"", true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
// HTML // begin [file="C:\\jakarta-tomcat-3.3.1a\\webapps\\examples\\jsp\\dxpt\\login_in.jsp";from=(0,99);to=(9,0)]
out.write("\r\n<html>;\r\n<head>;\r\n<title>;Untitled Document</title>;\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">;\r\n</head>;\r\n\r\n<body>;\r\n\r\n" ;
// end
// begin [file="C:\\jakarta-tomcat-3.3.1a\\webapps\\examples\\jsp\\dxpt\\login_in.jsp";from=(9,2);to=(52,0)]
String yhm = request.getParameter("yhm" ;
String yhmm = request.getParameter("yhmm" ;
Connection conn = null;
try
{
Class.forName( "com.sybase.jdbc2.jdbc.SybDriver" );
}
catch( java.lang.ClassNotFoundException ae )
{
System.err.println("ae:" + ae.getMessage());
}
String u ="jdbc:sybase:Tds:128.1.1.212:7200";
conn = DriverManager.getConnection(u,"dxpt","123456" ;
Statement stmt = conn.createStatement();
String query = "Select oper_name,oper_passwd from dx_operator where oper_no='yhm' and stat='0'";
ResultSet rs = null;
try
{
rs = stmt.executeQuery( query );
}
catch(SQLException be)
{
System.err.println("be.executeQuery:" + be.getMessage());
}
String OperName = rs.getString( 1 );
String OperPasswd = rs.getString( 2 );
rs.close();
conn.close();
if(yhmm.equals(OperPasswd))
{
out.println("欢迎光临" ;
}
else
{
out.println("密码错误" ;
}
// end
// HTML // begin [file="C:\\jakarta-tomcat-3.3.1a\\webapps\\examples\\jsp\\dxpt\\login_in.jsp";from=(52,2);to=(55,0)]
out.write("\r\n</body>;\r\n</html>;\r\n" ;
// end
} catch (Exception ex) {
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(ex);
} catch (Error error) {
throw error;
} catch (Throwable throwable) {
throw new ServletException(throwable);
}
} finally {
if (out instanceof org.apache.jasper.runtime.JspWriterImpl) {
((org.apache.jasper.runtime.JspWriterImpl)out).flushBuffer();
}
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
} |
|