Home > Database > Mysql Tutorial > body text

如何使用JSP连接DB2数据库_MySQL

WBOY
Release: 2016-06-01 14:06:53
Original
1223 people have browsed it

DB2


import ="java.util.*"
import ="java.io.*"
contentType="text/html; charset=gb2312"
%>


使用Db2数据库





使用JSP连接到Db2数据库


String host="192.1.1.127"; //数据库主机
String database="myweb"; //数据库名
String user="db2admin"; //用户名
String pass="db2admin"; //口令
%> java.sql.Statement sqlStmt; //语句对象
java.sql.ResultSet sqlRst; //结果集对象
try{


out.print ("连接数据库成功!");
%>

//关闭结果集对象
//sqlRst.close();
//关闭语句对象
//sqlStmt.close ();
//关闭数据库连接
sqlConn.close();
}catch (SQLException e)
{ out.print ("连接数据库失败!");
out.print (e);
}
%>

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!