Connecting to Sqlite Database in Electron JS - (Electron & Databases)

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 พ.ย. 2024

ความคิดเห็น • 89

  • @G5STU
    @G5STU 2 ปีที่แล้ว +5

    I’m a 43 ur old full stack dev , need to build a Win, Mac and Linux gui app. Was planning to use c++ but have now decided to use electron for speed of development , keep the vids coming my friend :)

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      Electron is a pretty good choice for rapid development. I've commercially released one app so far in it, and my second one is nearly ready to hit production.

  • @MatheusSilva-qm3ph
    @MatheusSilva-qm3ph 2 ปีที่แล้ว +2

    Your channel is very cool!
    Please make more!
    Thanks.

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      Thank you, I will

  • @Sirot1d
    @Sirot1d 2 ปีที่แล้ว +1

    Very helpful. keep as you do.

  • @tharukerajapaksha3652
    @tharukerajapaksha3652 2 ปีที่แล้ว +1

    Great video sir, Thank you

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      Glad you liked it

  • @khal-elbangcola8167
    @khal-elbangcola8167 2 ปีที่แล้ว +1

    You are amazing Sir. Thank you

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      You are welcome and happy learning!

  • @paulhuang2030
    @paulhuang2030 ปีที่แล้ว

    Thanks so much - great video

  • @kevinrauer
    @kevinrauer ปีที่แล้ว

    Very nice tutorial.. Really explains a lot.

  • @vishnukathika2546
    @vishnukathika2546 2 ปีที่แล้ว +1

    For Connecting to Databases like Ibm db2 and mysql what package should be installed.For me when i tried to run the application then in the console i am getting an error Unreferenced error for the var=require('mysql') in my javascript file.So my doubt render process does not have node apis ??

  • @erdincparlak7092
    @erdincparlak7092 ปีที่แล้ว

    Güzel bir anlatım olmuş.. Teşekkürler..

  • @blobropch0p
    @blobropch0p ปีที่แล้ว

    Thanks man you are a life saver

    • @coderjeet
      @coderjeet  ปีที่แล้ว

      You are welcome

  • @tripmad
    @tripmad ปีที่แล้ว

    Thanks for this video👍

  • @shivamkapoor1827
    @shivamkapoor1827 2 ปีที่แล้ว +2

    I am trying to make offline desktop app so plz tell me Is ipc needed to make crud application in electron or i have to use express in electron? But if i use express in electron it will work as online desktop aap in production.I dont find solution any where, if you can reply in this reguard.

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว +1

      You can use Express if you want to. It can be used in both online and offline apps. IPC is available to an express app too. However, I recommend KOA instead of Express if you start out now.

  • @dogustemizsoy9081
    @dogustemizsoy9081 2 ปีที่แล้ว +4

    Such a good video , i would love to see on how the packaging works for linux and others thank you !! I'm having really hard time on packaging. I can use this system with react too right?

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว +3

      Yes, you can use node.js with react, there is a separate setup for it though and you can find videos online on that.
      I am making training on packaging, we'll have it up soon.

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว +2

      I just put up a packaging video today.

  • @s1mple511
    @s1mple511 ปีที่แล้ว

    Hey it's already 3 days without sleeping and i cant figure out npm better-sqlite3-with-prebuilds and i receive error ERR! gyp ERR! can you help me..?

  • @abi3689
    @abi3689 หลายเดือนก่อน

    better-sqlite3-with-prebuilds is no longer supported, idk what to do now

  • @MatheusSilva-qm3ph
    @MatheusSilva-qm3ph 2 ปีที่แล้ว +2

    I'm starting to study now, and I don't know much about databases, but what I understand is that when I compile my program and pass it on to someone else, the database will be created if it doesn't exist, am I right? Thank you

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว +1

      You can ship the basic (empty) db file alongside your setup. If you want the db to be created, you'll need to write a function that'll create the db on first run.

  • @Zaxior
    @Zaxior 2 ปีที่แล้ว +4

    In case of 'table **** not found' even if name has match, try this:
    const sqlite = require('better-sqlite3-with-prebuilds');
    const path = require('path');
    const db = sqlite(path.resolve(__dirname, '../local.db'), {fileMustExist: true});
    exports.db = db;

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      Thank you for the tip!

    • @Zaxior
      @Zaxior 2 ปีที่แล้ว

      @@coderjeet btw, is there any chace to not refresh app after one of the methods to store/get data in sql is called?

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      @@Zaxior Don't understand your question

    • @Zaxior
      @Zaxior 2 ปีที่แล้ว

      @@coderjeet Basically as long as I don't use:
      db.exec(); all works fine, but as soon I call it, it refresh my whole app. I'm using react redux where I can keep my temp data in state, after app refresh it gone.

  • @kanishkakumarasiri9257
    @kanishkakumarasiri9257 10 หลายเดือนก่อน

    If I add react to this, nothing will different except the api calling inside the react file isn't it ?

  • @escanortheone668
    @escanortheone668 2 ปีที่แล้ว +1

    hey i am using electron forge with react, sqlite3 and typeorm when i am trying making the package , the sqlite3 file is not exporting with bundle is there any solution and not even creating ? and thanks a lots for amazing tutorial

  • @MagicTheKrakening
    @MagicTheKrakening ปีที่แล้ว

    Took a few years off from dev work. Come from front end design world and doing my first personal project that will push me into the backend dev world. Any tips on how to properly build a database for a beginner?

  • @MatheusSilva-qm3ph
    @MatheusSilva-qm3ph 2 ปีที่แล้ว

    Very cool. But I have a problem, when I try to add an item by clicking on a button it returns " Fatal error: throw as JavaScript exception napi_throw". Do you have any idea how to help me? It's a CRUD.

  • @mohamedyoussef8835
    @mohamedyoussef8835 2 ปีที่แล้ว +1

    Awesome Tutorial ++++++++++++++++++++++ Thank You.

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      Thank you ! :)

    • @diyatripathi503
      @diyatripathi503 9 หลายเดือนก่อน

      does ur code works?

  • @gioproyects9507
    @gioproyects9507 2 ปีที่แล้ว +1

    how i run the ./node_modules/.bin/electron-rebuild ?

    • @geniusidea6026
      @geniusidea6026 2 ปีที่แล้ว

      You can use git bash (windows) or .
      ode_modules\.bin\electron-rebuild.cmd

  • @galaxysoul3421
    @galaxysoul3421 4 หลายเดือนก่อน

    why can't I use require in my js file

  • @hrutvikkhunt4043
    @hrutvikkhunt4043 2 ปีที่แล้ว

    Can i use database located in another directory?

  • @prince-vp1bu
    @prince-vp1bu 2 ปีที่แล้ว

    Hi, I'm having an error in .
    ode_modules\.bin\electron-rebuild.cmd it keeps giving me an error which is :
    An unhandled error occurred inside electron-rebuild
    node-gyp failed to rebuild 'C:\Users\Admin\Desktop\Test
    ode_modules\better-sqlite3-with-prebuilds'.
    For more information, rerun with the DEBUG environment variable set to "electron-rebuild".
    Error: Could not find any Python installation to use
    why i'm having an error like this? can you suggest some solution for this 😅?

    • @anikokey7716
      @anikokey7716 2 ปีที่แล้ว

      same any fixed for this?

    • @anserwaseem3362
      @anserwaseem3362 2 ปีที่แล้ว

      @@anikokey7716 did you find any solution?

  • @ShawneeConsulting
    @ShawneeConsulting ปีที่แล้ว

    Thanks @coderJeet! Great vids. Having an issue with preload.js in your examples in this vid. If preload.js file is empty no error, but when I add code as in the vid I get error unable to load preload script and gives the the correct path. Any suggestions?

    • @ShawneeConsulting
      @ShawneeConsulting ปีที่แล้ว

      seems to use contextbrige, you also have to have contextIsolation: true in webPreferences... and double check your paths :)

    • @coderjeet
      @coderjeet  ปีที่แล้ว

      Thanks for pointing out

  • @RSurya99
    @RSurya99 2 ปีที่แล้ว

    Can i get the source code of this project? I have try following your video but still got an error like this when I try to do electron-rebuild :
    "Error: Could not find any Visual Studio installation to use"

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      Sorry, I didn't put this one in a repo.

    • @JuanCarlos611
      @JuanCarlos611 2 ปีที่แล้ว

      To fix that error you need to install Visual C++ Build Environment from here: visualstudio.microsoft.com/es/thank-you-downloading-visual-studio/?sku=BuildTools

    • @anserwaseem3362
      @anserwaseem3362 2 ปีที่แล้ว

      @@JuanCarlos611 and then do what?

  • @ДмитрийБелкин-и8ю
    @ДмитрийБелкин-и8ю 2 ปีที่แล้ว

    you wrapped js in Electron, but I want to wrapper React.js in Electron and connect to sqlite. Is it really?

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      Yep, you can absolutely do that.

    • @ДмитрийБелкин-и8ю
      @ДмитрийБелкин-и8ю 2 ปีที่แล้ว

      @@coderjeet after installing the electron-builder, my application does not react at all to my actions. Why?

  • @salemouail627
    @salemouail627 2 ปีที่แล้ว +1

    thanks so much , can u make a video on how to build with the database

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      Thanks for the suggestion

    • @salemouail627
      @salemouail627 2 ปีที่แล้ว

      i mean packaging ^^ thNkss

  • @tayebsida3mer923
    @tayebsida3mer923 2 ปีที่แล้ว

    when ever i try to install better-sqlite3-prebuilds it shows an error
    can anyone help me please 🙏

  • @matheusasilva1170
    @matheusasilva1170 2 ปีที่แล้ว

    At 12:35 what command did you use? As you did?

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว +1

      .
      ode_modules\.bin\electron-rebuild.cmd

  • @MrFenoma
    @MrFenoma 2 ปีที่แล้ว

    Hi first congratulate you for the video. I wanna ask you something. I didn't understand what you did with electron-rebuild, when you mention you had to set the whole path. I followed "npm i -D electron-rebuild" and then "npm i" but still receiving the same error. what Am I missing? Thanks!

    • @shanjainavithar1169
      @shanjainavithar1169 2 ปีที่แล้ว

      same issue have you got the solution?

    • @anserwaseem3362
      @anserwaseem3362 2 ปีที่แล้ว

      @@shanjainavithar1169 did anyone got the solution?

    • @ShawneeConsulting
      @ShawneeConsulting ปีที่แล้ว +1

      @@anserwaseem3362 I used ./node_modules/.bin/electron-rebuild in the terminal (can't see the underscore very well in the vid) and it fixed the issue. It's using the full relative path to call electron-rebuild.

  • @teamdailycode5594
    @teamdailycode5594 2 ปีที่แล้ว

    how to check that insert query is successfully executed in db, any flag ? @coderJeet

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      Yes, when you run an insert query, you will get a non zero return value if the query is successful

  • @abdelouahebbenouar6157
    @abdelouahebbenouar6157 2 ปีที่แล้ว

    I still got the errors when you rebuild electron

  • @hubert3728
    @hubert3728 4 หลายเดือนก่อน

    where is your repo on github? ....

  • @saulotarsobc
    @saulotarsobc ปีที่แล้ว

    Top. +1

    • @coderjeet
      @coderjeet  ปีที่แล้ว

      Appreciate it!

  • @adamfakrullah8265
    @adamfakrullah8265 2 ปีที่แล้ว

    what the difference between sqlite and sqlite3?

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      Sqlite3 is the latest version of the library.

  • @hrutvikkhunt4043
    @hrutvikkhunt4043 2 ปีที่แล้ว

    module not found:error!!!

  • @MOGE_
    @MOGE_ ปีที่แล้ว

    I faced a preload error and your solution didn't work.

    • @coderjeet
      @coderjeet  ปีที่แล้ว

      So sad to know

  • @diyatripathi503
    @diyatripathi503 9 หลายเดือนก่อน

    does anybody's code work?

  • @zeljkobanovic4398
    @zeljkobanovic4398 2 ปีที่แล้ว

    As usual... When working with namespaces (the most idiotic way of importing) I got stuck with scope for more than an hour and at the end it just cracked ... Unable to rebuild it on windows 10

    • @coderjeet
      @coderjeet  ปีที่แล้ว

      Hmm..

    • @Zordanus
      @Zordanus 11 หลายเดือนก่อน

      @@coderjeet Hmm.. is top answer -.-

    • @Zordanus
      @Zordanus 11 หลายเดือนก่อน

      have you found an alternative sqlite?

  • @matheusadmin4364
    @matheusadmin4364 2 ปีที่แล้ว

    Please give the git hub.

    • @coderjeet
      @coderjeet  2 ปีที่แล้ว

      Dont have one for this.

  • @tamirron1301
    @tamirron1301 2 ปีที่แล้ว +1

    Unfortunately, I've just wasted 15 hours...

  • @dwightledet5857
    @dwightledet5857 7 หลายเดือนก่อน

    This is awful. It might work, but the instructions are too jumpy.