SAK }‘ŠÙ

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠÙEƒJƒtƒF ˆê—— SAK Streets ŒŸõ
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

Oracle9i + ServletAJSP •Ò2 - JSP JDBC ƒAƒNƒZƒXAexecuteQuery

¡Oracle9i + JDBCAJAVA Server Page(JSP) ƒAƒNƒZƒX

  EOracle9i ‚Ì JDBC ƒhƒ‰ƒCƒo‚Ì”z’u‚âŠÂ‹«•Ï”Ý’èAáŠQ–â‘è‚Ȃǂ́A
    Oracle9i + ServletAJSP •Ò1 - Servlet JDBC ƒAƒNƒZƒXAgetConnection
    ‚Æ‹¤’Ê‚Å‚ ‚éB

¡Oracle9i + JDBCAJAVA Server Page(JSP) ƒAƒNƒZƒXƒeƒXƒg

  EJAVA Server Page(JSP) ‚©‚çAJDBC ‚Å Oracle9i ‚ɃAƒNƒZƒX‚·‚é‚ɂ́A
    ŽŸ‚̂悤‚É‚·‚éB

<%@ page import="java.util.*,java.sql.*;" contentType="text/html; charset=Shift_JIS"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<TITLE>JAVA Server Page(JSP) - Oracle9i JDBC Test</TITLE>
</HEAD>
<BODY>
<P>JAVA Server Page(JSP) - Oracle9i JDBC Test</P>
<%

  try {

    // Oracle9i JDBC ƒhƒ‰ƒCƒoƒ[ƒh
    Class.forName("oracle.jdbc.OracleDriver");

    // Oracle9i JDBC Ú‘±
    String dsn = "jdbc:oracle:thin:@sak-design:1521:sak";
    Connection cn = DriverManager.getConnection(dsn, "sak", "sak");

    // Oracle9i JDBC –â‚¢‡‚킹 SQL ì¬
    String sql = "select * from seqm";
    Statement st = cn.createStatement();

    // Oracle9i JDBC ƒŒƒR[ƒhƒZƒbƒgƒI[ƒvƒ“
    ResultSet rs = st.executeQuery(sql);

    // Oracle9i JDBC ƒŒƒR[ƒhƒZƒbƒgƒŠ[ƒh
    while (rs.next()) {
      out.println("<P>" + rs.getString(1) + "</P>");
    }

    // Oracle9i JDBC ƒŒƒR[ƒhƒZƒbƒgƒNƒ[ƒY
    rs.close();

    // Oracle9i JDBC ƒXƒe[ƒgƒƒ“ƒgƒNƒ[ƒY
    st.close();

    // Oracle9i JDBC Ú‘±ƒNƒ[ƒY
    cn.close();

  }
  catch (Exception e) {

    // ƒGƒ‰[ˆ—
    out.println("<P>error</P>");
  }

%>
</BODY>
</HTML>

  EJSP(test_oracle.jsp) ‚́Aƒ\[ƒX‚»‚Ì‚à‚Ì‚ð
    /jakarta-tomcat-3.3.1/webapps/sak/jsp/ ‚Ì’†‚É”z’u‚µA
    ƒuƒ‰ƒEƒU‚æ‚èAŽŸ‚Ì URL ‚ÅŽÀs‚·‚éB

http://sak-design:8080/sak/jsp/test_oracle.jsp

¡PostgreSQL •ÒAJAVA ServletAJSP •ÒŽ‘—¿
¡MySQL •ÒŽ‘—¿
¡SQL Šî‘b•ÒŽ‘—¿
¡SQL Šî‘bŽÀ’n•ÒŽ‘—¿
¡SQL ƒ`ƒ…[ƒjƒ“ƒO•ÒŽ‘—¿
¡Oracle PL/SQL •ÒŽ‘—¿
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠÙEƒJƒtƒF ˆê—— SAK Streets ŒŸõ



Copyright (C) 1999-2017 Y.SAK