當前位置:首頁 » 網路資訊 » 怎樣進網站資料庫
擴展閱讀
艾灸當天可以喝酸奶嗎 2025-05-22 10:57:16
可以把圖片中間縮短嗎 2025-05-22 10:56:30
u盤文件可以發手機 2025-05-22 10:55:02

怎樣進網站資料庫

發布時間: 2023-07-12 11:31:35

『壹』 如何直接訪問網站的資料庫

1、先創建程序所要訪問的資料庫,打開控制梁渣面板,建立ODBC數據源:開始→設置→控制面板→管理工具→ODBC數據源→系統DSN。

2、然後編寫資料庫訪問程序:在程序中首先要載入驅動,其次要建立連接,再次創建嫌段用於訪問資料庫的芹渣譽Statement對象,然後利用Statement對象訪問資料庫

Class.forName(「sun.jdbc.odbc.JdbcOdbcDriver」);

Stringurl="jdbc:odbc:book";

Stringquery="SELECT*FROMbook1";

Connectionc=DriverManager.getConnection(Url,user,password);

Connectioncon=DriverManager.getConnection(url);

Statementstmt=con.createStatement();

ResultSetrs=stmt1.executeQuery(query);

建立連接之後,可以訪問資料庫,對資料庫進行操作,如:查詢、修改、刪除。

連接使用完畢,可以調用close()方法關閉連接.

importjava.sql.*;

classSimpleSelect{

publicstaticvoidmain(Stringargs[]){

Stringurl="jdbc:odbc:book";

Stringquery="SELECT*FROMbook1";

try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

}

catch(java.lang.ClassNotFoundExceptione){

System.err.print("ERROR:");

System.err.print(e.getMessage());

}

//輸出資料庫中信息

try{

Connectioncon=DriverManager.getConnection(url);

Statementstmt=con.createStatement();

ResultSetr=stmt.executeQuery(query);

System.out.println("id:"+""+"name"+""+"price"+""+"author"+""+"publish_name");

while(r.next()){

Longr1=r.getLong("id");

Stringr2=r.getString("name");

Doubler3=r.getDouble("price");

Stringr4=r.getString("author");

Stringr5=r.getString("publish_name");

System.out.println(r1+""+r2+""+r3+""+r4+""+r5);

}

r.close();

stmt.close();

con.close();

}catch(SQLExceptionex){

ex.printStackTrace();

}

}

『貳』 請問怎麼進入自己網站的資料庫

網站的後台一般是不能進入資料庫的,(當然不排除有這種可能)
一般的網站都有自己的域名,有域名就有資料庫,可以直接訪問(就像網站一樣,輸入網址,然後就會有登陸框),如果是本地的話,安裝好伺服器和資料庫,也可以直接用地址訪問

『叄』 怎麼進入自己網站的資料庫啊

有ftp就可以,在ie地址欄直接輸入ftp地址。
或者到dw里設置直接連接網站伺服器。
或者使用cutftp連接。都可以的。但是前提是你有用戶名和密碼。