Java電腦語言和資料庫管理系統結合起來,才能使Java在 大型應用程式系統之中擔當重任。本文介紹連接資料庫的 JDBC規範的原理、架構、應用程式介面和驅動程式等,並 以測試工具實例來介紹Java編碼的方式。 Java和資料庫相通的介面JDBC是最新流行 Web電腦技術的 幕後大功臣。本文用一個簡單的供應商管理系統實例來說 明如何用JDBC來做資料庫記錄的建立、更新、刪除和查詢 等工作,並且介紹一些JDBC程式設計的內幕。Under Construction ...
本文全文見 HOPE NET 光碟月刊第 36 期,1997 年 五月號 , 第 37 期,1997 年 六月號 和 第 38 期,1997 年 七月號 。
For Java JDK 1.1.x, the JDBC dirver should be like this:
private boolean dbLogin(String stUserId, String stPassword)
{
try {
String stJdbcUrl = "jdbc:odbc:SQLServer";
// Load the jdbc-odbc bridge driver
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
// Attempt to connect to a driver. Each one
// of the registered drivers will be loaded until
// one is found that can process this URL
myDbConnection = DriverManager.getConnection (
stJdbcUrl, stUserId, stPassword);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
歡迎對本站內容提出您的寶貴意見, E-mail: symonchang@earthlink.net