欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

IntellJIdea2020版怎么添加sqlite數(shù)據(jù)庫(kù)-創(chuàng)新互聯(lián)

本篇內(nèi)容介紹了“IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

成都創(chuàng)新互聯(lián)公司10多年企業(yè)網(wǎng)站設(shè)計(jì)服務(wù);為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁(yè)設(shè)計(jì)及高端網(wǎng)站定制服務(wù),企業(yè)網(wǎng)站設(shè)計(jì)及推廣,對(duì)成都葡萄架等多個(gè)方面擁有多年的網(wǎng)站維護(hù)經(jīng)驗(yàn)的網(wǎng)站建設(shè)公司。

工具列表:

1.Sqlite

2. SQLiteStudio

3. IntellJ

4. sqlite-jdbc-3.32.3.2.jar

運(yùn)行結(jié)果先睹為快:

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

下載安裝IntellJ

直接到官網(wǎng)下載即可,新手建議不要下載新的,一旦編譯器UI上有修改和教程對(duì)不上號(hào),自己爬樓摸索比較話時(shí)間。當(dāng)然也會(huì)有第一手的寶貴收獲。

https://www.jetbrains.com/idea/download/#section=windows

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

下載Sqlite開(kāi)發(fā)工具

https://www.sqlite.org/download.html

解壓后直接可以運(yùn)行,無(wú)需安裝。

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

創(chuàng)建數(shù)據(jù)庫(kù)文件

創(chuàng)建studio.sqlite名稱(chēng)的數(shù)據(jù)庫(kù)文件。

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

注釋?zhuān)喝绻霈F(xiàn)無(wú)法生成的現(xiàn)象,在“sqlite>”后輸入任意非空字符后回車(chē)然后Ctrl+C取消即可生成studio.sqlite文件。(.sqlite,.db后綴數(shù)據(jù)庫(kù)文件均可識(shí)別。)

此處如果只創(chuàng)建一個(gè)空白的文件,也可以用修改后綴的方法直接新建一個(gè)*.db文件。

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

數(shù)據(jù)庫(kù)文件寫(xiě)入數(shù)據(jù)

這個(gè)網(wǎng)絡(luò)地址可以下載SQLiteStudio,還有使用教程。可以方便的錄入數(shù)據(jù)。

http://www.xue51.com/soft/4831.html

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

數(shù)據(jù)庫(kù)錄入數(shù)據(jù)

錄入示例數(shù)據(jù)和字段完成如下所示:

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

進(jìn)入IntellJ配置數(shù)據(jù)庫(kù)

此時(shí)發(fā)現(xiàn)Tool Windows中沒(méi)有Database選項(xiàng),需要安裝Database工具包。

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

File-》Settings-》Plugins

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

選擇Plugins,搜索框搜索database,安裝“Database Navigator”,然后重啟Intellj應(yīng)用。

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

重啟后,左邊框會(huì)出現(xiàn)“DB Browser”選項(xiàng)。

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

java代碼如下:

import java.sql.*;
 
public class database {
  public static void main(String[] arg) throws ClassNotFoundException, SQLException {
    System.out.println("database");
    Connection conn = null;
    ResultSet rs = null;
    Statement statement;
    Class.forName("org.sqlite.JDBC");//sqlite database name.
    conn = DriverManager.getConnection("jdbc:sqlite:F:\\codeZ\\database\\mysqlite1.sqlite");
    statement = conn.createStatement();
    rs = statement.executeQuery("SELECT * FROM demo"); //this is name of database list
    while (rs.next()){
      System.out.println("--------------------");
      System.out.print("id:"+rs.getString("id"));
      System.out.print("  name:"+rs.getString("name"));
      System.out.println("  age:"+rs.getString("age"));
    }
 
  }
}

注意:

1. 數(shù)據(jù)庫(kù)操作函數(shù)中存在異常,因此需要包含ClassNotFoundException, SQLException,參考編譯器調(diào)試添加即可。

運(yùn)行結(jié)果如下所示:

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

附錄:

問(wèn)題一:數(shù)據(jù)庫(kù)加載失敗

出現(xiàn)如下錯(cuò)誤,可能是沒(méi)有添加jar包導(dǎo)致。sqlite-jdbc-3.32.3.2.jar

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

file-》Project structure-》

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

添加sqlite-jdbc-3.32.3.2.jar,記得勾選。

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

問(wèn)題二:

如下URL對(duì)應(yīng)的就是數(shù)據(jù)庫(kù)的路徑和名稱(chēng)。

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

問(wèn)題三:無(wú)法連接數(shù)據(jù)庫(kù)

查看數(shù)據(jù)庫(kù)url名稱(chēng),并且運(yùn)行代碼之前確保數(shù)據(jù)庫(kù)是disconnect狀態(tài)。

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

題四:讀取表信息失敗

如下為數(shù)據(jù)庫(kù)創(chuàng)建的表名字不對(duì)應(yīng),使用SQLiteStudio打開(kāi)數(shù)據(jù)庫(kù)文件查看DLL(參考上面的圖)修改為正確的名稱(chēng)即可。

IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)

“IntellJ Idea 2020版怎么添加sqlite數(shù)據(jù)庫(kù)”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

網(wǎng)頁(yè)名稱(chēng):IntellJIdea2020版怎么添加sqlite數(shù)據(jù)庫(kù)-創(chuàng)新互聯(lián)
網(wǎng)頁(yè)鏈接:http://chinadenli.net/article18/eipgp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站面包屑導(dǎo)航網(wǎng)站改版網(wǎng)站維護(hù)手機(jī)網(wǎng)站建設(shè)企業(yè)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化