国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

RedHatLinux網絡服務器構架實務(八)

2019-09-08 23:17:57
字體:
來源:轉載
供稿:網友

//獲取字段值,參數為字符串--字段名
publicStringgetString(StringfieldName)
throwsSQLException{
 returnrs.getString(fieldName);
}
//上移指針
publicbooleanprevious()
throwsSQLException{
 if(rs==null)
thrownewSQLException("ResultSetisnull.");
 returnrs.previous();
}

//下移指針
publicbooleannext()
throwsSQLException{
 if(rs==null)
thrownewSQLException("ResultSetisnull.");
 returnrs.next();
}

//指針最上
publicbooleanfirst()
throwsSQLException{
 if(rs==null)
thrownewSQLException("ResultSetisnull.");
 returnrs.first();
}

//指針最下
publicbooleanlast()
throwsSQLException{
 if(rs==null)
thrownewSQLException("ResultSetisnull.");
 returnrs.last();
}

//清除變量,當你僅需要清除變量而不關庫時可調用此方法
privatevoidclear()throwsSQLException{
if(rs!=null)rs.close();
 rs=null;
 if(stmt!=null)stmt.close();
 stmt=null;
}

//清除變量并關庫
publicvoidclose()throwsSQLException{
 clear();
if(conn==null)
 thrownewSQLException("Thisconnectionhasbeenclosedalready.");
 if(conn.isClosed())
thrownewSQLException("Thisconnectionhasbeenclosed.");
 conn.close();
 conn=null;
}

 }

2編寫邏輯層代碼
##在客戶端創建dbbridge.jsp,然后上傳到服務器端即可:

##上級要來視察某官僚的工作,只見該官僚指揮若定:
##邏輯層對處理層說:小子,去跟我的后臺聯絡一下。//連庫并初始化
<jsp:useBeanid="bridge"class="com.gledecity.yesgo.sql.DBBridge"/>
##邏輯層對處理層說:把我們今年的工作成果準備一下。//執行SQL語句
<%bridge.execSQL("select*fromprov");
##邏輯層對處理層說:材料準備好了?干得好!上級一來看到一片數據。//循環顯示
while(bridge.next())
{out.print(bridge.getString("prov_id")+bridge.getString("prov_name")+"<br>");}
##邏輯層對處理層說:好了好了,政績顯示完畢,你們通通滾蛋吧。//關閉所有變量
bridge.close();%>
##上級看后非常滿意,拍拍官僚的肩膀:"干得不錯!"官僚一高興,說:"哪里哪里,都是下屬辦事得力!"

3測試該程序
lynxhttp://www.yesgo.loc/dbbridge.jsp
##當然你也可以在客戶端瀏覽器測試,只是你需要將你服務器的IP添加到你網絡設置中的DNS列表中。

##處理的結果是數據庫中所有的數據:


1安徽
2北京
3重慶
4福建
5甘肅
6廣東
7廣西
8貴州
9海南
10河北
11黑龍江
12河南
13湖北
14湖南
15內蒙古
16江蘇
17江西
18吉林
19遼寧
20寧夏
21青海
22山西
23陜西
24山東
25上海
26四川
27天津
28西藏
29新疆
30云南
31浙江
32香港
33澳門
34臺灣

例四:測試PHP
1創建源文件
touch/home/www/test.php
chmod701/home/www/test.php

2編輯源文件
vitest.php
##源代碼如下:
<?
phpinfo();
?>

3測試該程序
lynxhttp://

Apache/1.3.22Serveratwww.yesgo.locPort80

原因可能是:

1、你沒有為該目錄或者該文件設置guest組權限;
2、你沒有將該文件名設置為默認頁面,尤其是在僅用域名訪問的情況下。
解決辦法:
chmod701/home/www
chmod701/home/www/*

vi/usr/local/apache/conf/httpd.conf
DirectoryIndexindex.htmlindex.jspindex.xtpindex.phpindex.php3

常見錯誤二:404NotFound

404NotFound
/index.jspwasnotfoundonthisserver.

Resin2.0.5(builtThuNov1517:56:24PST2001)

原因可能是:
1、你請求的文件名輸入錯誤;
2、你沒有在resin.conf和httpd.conf中都建立相應的主機。

解決辦法:
1、檢查文件名,尤其注意大小寫問題;
2、參照Resininstall步驟中的配置支持JSP的虛擬主機部分。

常見錯誤三:java.lang.ClassNotFoundException

500ServletException
java.lang.ClassNotFoundException:org.gjt.mm.mysql.Driver
atcom.caucho.util.DynamicClassLoader.loadClass(DynamicClassLoader.java:479)
atjava.lang.ClassLoader.loadClass(ClassLoader.java:253)

atjava.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
atjava.lang.Class.forName0(NativeMethod)
atjava.lang.Class.forName(Class.java:120)
at_cnmysql__jsp._jspService(/cnmysql.jsp:4)
atcom.caucho.jsp.JavaPage.service(JavaPage.java:74)
atcom.caucho.jsp.Page.subservice(Page.java:485)
atcom.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:176)
atcom.caucho.server.http.Invocation.service(Invocation.java:278)
atcom.caucho.server.http.CacheInvocation.service(CacheInvocation.java:129)
atcom.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:338)
atcom.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:270)
atcom.caucho.server.TcpConnection.run(TcpConnection.java:140)
atjava.lang.Thread.run(Thread.java:484)

Resin2.0.5(builtThuNov1517:56:24PST2001)

原因可能是:
1、你沒有安裝驅動程序;
2、驅動程序沒有設置到系統CLASSPATH中。

解決辦法:
參見ClassesInstall和edit/etc/profile兩部分

網絡服務器 RedHatLinux

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 陵川县| 乌鲁木齐县| 连云港市| 邯郸县| 洛浦县| 涪陵区| 罗山县| 肃南| 策勒县| 泊头市| 永昌县| 通榆县| 桃园县| 崇左市| 福安市| 蛟河市| 固安县| 琼海市| 阳江市| 汝州市| 宜春市| 抚宁县| 农安县| 信丰县| 集安市| 舒城县| 海南省| 南澳县| 怀集县| 昭觉县| 剑阁县| 西畴县| 酉阳| 伊宁县| 三亚市| 商丘市| 日喀则市| 衢州市| 广丰县| 衢州市| 栾城县|