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 + ServletAJSP •Ò2 - JSP JDBC ƒAƒNƒZƒXAexecuteQuery

¡Oracle9i + JDBCAJAVA Server Page(JSP) ƒAƒNƒZƒX

  EOracle9i ‚Ì JDBC ƒhƒ‰ƒCƒo‚Ì”z’u‚âŠÂ‹«•Ï”Ý’èAáŠQ–â‘è‚È‚Ç‚ÍA
    Oracle9i + ServletAJSP •Ò1 - Servlet JDBC ƒAƒNƒZƒXAgetConnection
    ‚Æ‹¤’Ê‚Å‚ ‚éB

¡Oracle9i + JDBCAJAVA 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 ServletAJSP •ÒŽ‘—¿
¡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-2024 Y.SAK