Tập tin global.asa
<OBJECT RUNAT=Server SCOPE=Application ID=OraSession PROGID="OracleInProcServer.XOraSession"></OBJECT>
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart
OraSession.CreateDatabasePool 20, 100, 600, "muave", "thi/ntmt", 0
End Sub
Sub Application_OnEnd
OraSession.DestroyDatabasePool
End Sub
Sub Session_OnStart
End Sub
Sub Session_OnEnd
End Sub
</SCRIPT>
Đoạn mã kết nối và truy vấn dữ liệu
<% set OraDatabase = OraSession.getDatabaseFromPool(10)
set OraDynaset = OraDatabase.CreateDynaset("SELECT mahang, tenhang, mota, hinh, dongia, deref(maloairef).maloai from mathang_t”)
while not rs.eof
mahang = rs("mahang")
tenhang = rs("tenhang")
rs.MoveNext
wend
rs.close
OraDynaSet.close
%>
<%@ page import="java.sql.*,javax.sql.*,oracle.jdbc.driver.*,oracle.sql.*" %>
<%
DriverManager.registerDriver(new OracleDriver());
Connection con =
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:csdl","bhang","bhang");
Statement stm = con.createStatement();
ResultSet rs = stm.executeQuery("SELECT mahang, tenhang, mota, hinh, dongia, deref(maloairef).maloai from mathang_t where deref(maloairef).maloai='01’”);
while (rs.next()) {
String mahang = rs.getString("mahang");
String tenhang=rs.getString("tenhang");
}
con.close();
stm.close(); %>
» Tin mới nhất:
» Các tin khác: