天天影视色欲 影视|不卡人妻高清有码视频|五月天AV在线免费观看|久久在精品线影院精品国产|亚洲欧美日韩综合一区久久|欧美国产日本高清不卡免费|日韩Av无码久久区二区三区|亚洲の无码国产の无码AV性色

  • <noscript id="fhf7a"></noscript>
  • <rp id="fhf7a"></rp>

      <track id="fhf7a"></track>
      1. <rp id="fhf7a"><dl id="fhf7a"></dl></rp> <p id="fhf7a"><pre id="fhf7a"><optgroup id="fhf7a"></optgroup></pre></p>
        <small id="fhf7a"><dl id="fhf7a"></dl></small>
        <track id="fhf7a"><dl id="fhf7a"></dl></track>
        <source id="fhf7a"></source>

        <track id="fhf7a"><dl id="fhf7a"><delect id="fhf7a"></delect></dl></track>

        臺(tái)州網(wǎng)站設(shè)計(jì)

        臺(tái)州網(wǎng)站設(shè)計(jì) 服務(wù)熱線:189-6848-5822  在線服務(wù):

        首頁(yè) 關(guān)于創(chuàng)遠(yuǎn) 服務(wù)項(xiàng)目 成功案例 客戶服務(wù) 新聞中心 客戶留言 聯(lián)系我們
        臺(tái)州網(wǎng)站設(shè)計(jì)
         
        臺(tái)州網(wǎng)站設(shè)計(jì)
        服務(wù)流程
        建站知識(shí)
        常見(jiàn)問(wèn)題
           
         
        如何jsp連接數(shù)據(jù)庫(kù)
         

        一定將jdbc的驅(qū)動(dòng)程序放到服務(wù)器的類(lèi)路徑里,然后要在數(shù)據(jù)庫(kù)里建一個(gè)表test,有兩個(gè)字段比如為test1,test2,可以用下面SQL建
        create table test(test1 varchar(20),test2 varchar(20)
        然后向這個(gè)表寫(xiě)入一條測(cè)試紀(jì)錄 


        一、jsp連接Oracle8/8i/9i數(shù)據(jù)庫(kù)(用thin模式)
        testoracle.jsp如下:
        <%@ page contentType="text/html;charset=gb2312"%>
        <%@ page import="java.sql.*"%>
        <html>
        <body>
        <%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
        String url="jdbc:oracle:thin:@localhost:1521:orcl";
        //orcl為你的數(shù)據(jù)庫(kù)的SID
        String user="scott";
        String password="tiger";
        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ù)庫(kù)操作成功,恭喜你");%>
        <%rs.close();
        stmt.close();
        conn.close();
        %>
        </body>
        </html>


        二、jsp連接Sql Server7.0/2000數(shù)據(jù)庫(kù)
        testsqlserver.jsp如下:
        <%@ page contentType="text/html;charset=gb2312"%>
        <%@ page import="java.sql.*"%>
        <html>
        <body>
        <%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
        String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs";
        //pubs為你的數(shù)據(jù)庫(kù)的
        String user="sa";
        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ù)庫(kù)操作成功,恭喜你");%>
        <%rs.close();
        stmt.close();
        conn.close();
        %>
        </body>
        </html>


        三、jsp連接DB2數(shù)據(jù)庫(kù)
        testdb2.jsp如下:
        <%@ 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ù)庫(kù)名
        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ù)庫(kù)操作成功,恭喜你");%>
        <%rs.close();
        stmt.close();
        conn.close();
        %>
        </body>
        </html>


        四、jsp連接Informix數(shù)據(jù)庫(kù)
        testinformix.jsp如下:
        <%@ page contentType="text/html;charset=gb2312"%>
        <%@ page import="java.sql.*"%>
        <html>
        <body>
        <%Class.forName("com.informix.jdbc.IfxDriver").newInstance();
        String url =
        "jdbc:informix-sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver;
        user=testuser;password=testpassword";
        //testDB為你的數(shù)據(jù)庫(kù)名
        Connection conn= DriverManager.getConnection(url);
        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ù)庫(kù)操作成功,恭喜你");%>
        <%rs.close();
        stmt.close();
        conn.close();
        %>
        </body>
        </html>


        五、jsp連接Sybase數(shù)據(jù)庫(kù)
        testmysql.jsp如下:
        <%@ page contentType="text/html;charset=gb2312"%>
        <%@ page import="java.sql.*"%>
        <html>
        <body>
        <%Class.forName("com.sybase.jdbc.SybDriver").newInstance();
        String url =" jdbc:sybase:Tds:localhost:5007/tsdata";
        //tsdata為你的數(shù)據(jù)庫(kù)名
        Properties sysProps = System.getProperties();
        SysProps.put("user","userid");
        SysProps.put("password","user_password");
        Connection conn= DriverManager.getConnection(url, SysProps);
        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ù)庫(kù)操作成功,恭喜你");%>
        <%rs.close();
        stmt.close();
        conn.close();
        %>
        </body>
        </html>


        六、jsp連接MySQL數(shù)據(jù)庫(kù)
        testmysql.jsp如下:
        <%@ page contentType="text/html;charset=gb2312"%>
        <%@ page import="java.sql.*"%>
        <html>
        <body>
        <%Class.forName("org.gjt.mm.mysql.Driver").newInstance();
        String url ="jdbc:mysql://localhost/softforum?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
        //testDB為你的數(shù)據(jù)庫(kù)名
        Connection conn= DriverManager.getConnection(url);
        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ù)庫(kù)操作成功,恭喜你");%>
        <%rs.close();
        stmt.close();
        conn.close();
        %>
        </body>
        </html>


        七、jsp連接PostgreSQL數(shù)據(jù)庫(kù)
        testmysql.jsp如下:
        <%@ page contentType="text/html;charset=gb2312"%>
        <%@ page import="java.sql.*"%>
        <html>
        <body>
        <%Class.forName("org.postgresql.Driver").newInstance();
        String url ="jdbc:postgresql://localhost/soft"
        //soft為你的數(shù)據(jù)庫(kù)名
        String user="myuser";
        String password="mypassword";
        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ù)庫(kù)操作成功,恭喜你");%>
        <%rs.close();
        stmt.close();
        conn.close();
        %>
        </body>
        </html>

        返回】 【字號(hào) 發(fā)布日期:2011-5-16
          上一篇: 無(wú)   下一篇: 拒絕做肉雞 防止別人讀取你的硬盤(pán)
         
        m.wu999999999.com  Xml網(wǎng)站地圖  Html網(wǎng)站地圖  Copyright 2008 - 2022 All rights reserved. 版權(quán)所有 © 臺(tái)州創(chuàng)遠(yuǎn)網(wǎng)絡(luò)技術(shù)有限公司 浙ICP備11018227號(hào)
        地址:臺(tái)州市椒江區(qū)東環(huán)大道(星星廣場(chǎng)對(duì)面)君悅大廈B幢1217-1室 郵編:318000  電話:189-6848-5822 E-mail:tzcyuan@163.com

          本頁(yè)關(guān)鍵詞:臺(tái)州網(wǎng)站設(shè)計(jì)

        太保市| 黄梅县| 彭阳县| 伊金霍洛旗| 霍山县| 土默特右旗| 衡阳市| 清镇市| 邯郸县| 浮山县| 双柏县| 兴和县| 贡嘎县| 兰溪市| 保山市| 田阳县| 阜南县| 泊头市| 光泽县| 紫云| 南皮县| 平潭县| 南汇区| 丹东市| 泾阳县| 登封市| 镇康县| 朔州市| 灌阳县| 江源县| 长沙县| 孟村| 浮梁县| 沂源县| 获嘉县| 土默特右旗| 静安区| 建阳市| 化隆| 星座| 商水县|