29.06.2013 Views

Java 程式設計基礎班(10) - 網路資料庫實驗室

Java 程式設計基礎班(10) - 網路資料庫實驗室

Java 程式設計基礎班(10) - 網路資料庫實驗室

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

建立ODBC範例<br />

Class <strong>10</strong><br />

ODBC資料來源的建立與關閉<br />

1. import java.sql.*<br />

Class <strong>10</strong><br />

Class.forName 載入驅動程式<br />

Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”)<br />

2. 連線:Connection<br />

Con=DriverManager.getConnextion(“jdbc:odb<br />

c:ODBC資料來源名稱”,“使用者帳號”,“密碼”)<br />

3. 關閉:Connection 物件變數.close();<br />

25<br />

26<br />

13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!