中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

JSP連接DB2數(shù)據(jù)庫

2018-07-20    來源:open-open

容器云強(qiáng)勢上線!快速搭建集群,上萬Linux鏡像隨意使用
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
    <body>
        <%
            Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();
            String url = "jdbc: db2://localhost:5000/sample";
            //sample為你的數(shù)據(jù)庫名
            String user = "admin";
            String password = "";
            Connection conn = DriverManager.getConnection(url, user, password);
            Statement stmt = conn
                    .createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                            ResultSet.CONCUR_UPDATABLE);
            String sql = "select * from test";
            ResultSet rs = stmt.executeQuery(sql);
            while (rs.next()) {
        %>
        您的第一個(gè)字段內(nèi)容為:<%=rs.getString(1)%>
        您的第二個(gè)字段內(nèi)容為:<%=rs.getString(2)%>
        <%
            }
        %>
        <%
            out.print("數(shù)據(jù)庫操作成功,恭喜你");
        %>
        <%
            rs.close();
            stmt.close();
            conn.close();
        %>
    </body>
</html>

標(biāo)簽: 數(shù)據(jù)庫

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:百度與谷歌地圖坐標(biāo)轉(zhuǎn)換代碼

下一篇: python 去除html標(biāo)簽的代碼