Local SQLite Database for Expo React Native App with Import and Export Database from Device Files

Поделиться
HTML-код
  • Опубликовано: 17 окт 2024
  • Hi everyone!
    Today I am going to show you how to create an app that connects to a local database. I will cover the basic CRUD operations of creating (insert), reading (select), updating (update) and deleting (delete) records. I will also cover creating a table.
    Sometimes you may want to import/export your database so I will also cover this.
    If you would like to see my expo-sqlite example, the source code is available on my GitHub:
    github.com/che...
    For the expo-sqlite documentation you can see the expo documentation:
    docs.expo.dev/...
    To learn about sqlite queries:
    www.sqlitetuto...
    You’ve clearly come here to learn and a free audible trial allows you to increase your learning potential in situations where you may be hands free like at the gym or on your commute. It allows you to spend more time on theory when you aren’t able to watch a screen, so that you can maximise your screen time to pick up technical skills. Try it for free today:
    amzn.to/49NX6Xe
    // ABOUT ME
    My name is Chelsea and I started studying software engineering in 2010. I have been working commercially full time since 2014 and have been in various positions from graduate developer to tech lead to solution architect.
    I'm a full stack developer with a lot of experience in C# and Javascript but my passion is for mobile development; specifically native iOS development and cross platform using React Native.
    I always have many things on the go and am always trying out a new side hustle and failing at it; perhaps you can learn from my mistakes!
    Please like and subscribe if you enjoyed this video and want to see more like it!
    Have any suggestions on topics you would like to learn more about? Please suggest them in the comments... I would love to help you out while doing a bit of learning myself!
    // PRODUCTS USED
    I use the following products in the creation of my videos:
    Boya MM1 Microphone - amzn.to/3uupmOB
    A reasonable quality and reasonably sturdy but cost effective microphone that can be used by both DSLR cameras, mobile phones and laptops
    Canon 18-55mm Lens - amzn.to/3QYYdLk
    A kit lens but a decent quality lens for beginners getting used to a DSLR
    Canon EOS Rebel T7 with 18-55mm Lens - amzn.to/3GdRPuq
    This is the kit I started with it includes the lens linked above and is a great starter camera.
    I love Apple devices... These are the ones I use for my channel content creation:
    Apple iPhone 13 - amzn.to/3G8pHcl
    A good all round phone, good for Apple development and recording videos with enough high quality features but at a cheaper price point than the pro versions.
    Apple MacBook Pro - amzn.to/3MUuPV8
    A nice portable computer for working from anywhere and perfect for iOS development
    Apple iPad Air - amzn.to/49LvYrY
    Really easy to use for graphic design if required for logos as part of my app development or editing the videos on the go.
    DISCLAIMER: Links included in this description might be affiliate links. If you purchase a product or service with the links that I provide I may receive a small commission. There is no additional charge to you! Thank you for supporting my channel so I can continue to provide you with free content each week!
    //CONTACT:
    Please contact me at: hello@tripwiretech.com
    //CRAVING MORE:
    You can find links to all my different sites and social media over on Linktree: linktr.ee/miss...

Комментарии • 64

  • @lanigoespew
    @lanigoespew 6 месяцев назад +4

    Your content is simple and straight to the point, PLEASE don't stop making React-Native tutorials I'm actually begging hahaha.

  • @indecisive.m
    @indecisive.m Год назад +5

    Just wanted to leave a message to say thanks. This helped me so much. The Expo docs for this are really not overly helpful but you walked through it and thanks to you I managed to convert my app from using async storage to this.

  • @corybcromer
    @corybcromer 23 часа назад

    Love your tutorials!!! Question, how did you find out that the openDatabase func looks in the SQLite directory. I didnt see that anywhere in the docs, and I was looking forever. ahah.

  • @chippandenga6722
    @chippandenga6722 Год назад +3

    This was amazing. Phew! So much packed into 38 minutes. Loved the video and its content.💙

  • @kingogamer4358
    @kingogamer4358 Год назад +1

    I was really for the need of local database and when i was searching for it you uploaded the video and that really helped aloooot thanks for that video

  • @supp3rv1ctor
    @supp3rv1ctor 5 месяцев назад

    Do you know anything about SQLite working perfectly on Expo Go, and after generating a build it doesn't work on the device?

  • @mintmikasa
    @mintmikasa 6 месяцев назад

    Nice content! I'm considering using a local or remote database in my app data, mostly for cost reasons. I was wondering how much data is considered "too much" to be stored locally as far as performance and acceptable app sizes go? It's hard to get a gauge of that without actually ingesting my data into my own sqlite db first, so I was wondering if you had any experience with that. Thanks!

  • @Tony-jr3ki
    @Tony-jr3ki Год назад +1

    Thank you for the awesome video. How would you go about accessing the database from different components? Is it necessary to use some sort of global state for that? So we wouldn't create an instance of db access in each component? Or is there some other way to do that?

  • @isurujn
    @isurujn Год назад +1

    I came across your videos when I was searching for React Native tutorials. You have videos on some great topics and your teaching style is great too.
    Unfortunately I'm not using Expo. I wish there were more videos on React Native CLI as well.

    • @wanwan-swagg
      @wanwan-swagg Год назад

      React native have alot of bugs in it. Can't even symlink because it's unsupported.

  • @emilieclair
    @emilieclair 3 месяца назад +1

    thank you it is very useful but can you update it with the new functionalities of expo-sqlite? thank you, i'm stuggling with the documentation, more promesses are made and they added sync and async to functions. Thank you!

  • @GeorgeFlorian12
    @GeorgeFlorian12 Час назад

    Unfortunately, Expo moves so fast that nothing from this video works now. Even `expo` as a command is deprecated. Not to mention expo-sqlite had an overhaul.

  • @shehzadpasha6583
    @shehzadpasha6583 Год назад +3

    Thank you for explaining SQLite. I followed the steps mentioned in the video, on iOS it works fine, but on Android I am unable to import the database. It exports well, import is done without errors, but the database table shows no record. Any suggestions?

    • @AK-kq1mk
      @AK-kq1mk Год назад

      Did you figure it out?

    • @MunibDalati
      @MunibDalati Год назад

      same problem here

    • @failogy
      @failogy 6 месяцев назад

      same problem. pls tell me if you know.

  • @Evalionn
    @Evalionn Год назад +2

    Hi,
    Anyone tested this in release build? It’s not working when I build for release

  • @AlejandroHernandez-mh5om
    @AlejandroHernandez-mh5om Год назад

    I hope you can help me, I'm making an app and I have to download information with an API and host it locally, but I have a question, is there any way to know when the information I'm downloading finished and was saved in the SQLite table?
    By the way, the video is great.

  • @jeka2233
    @jeka2233 Год назад

    Thank you so much for the tutorial miss coding,could you tell me please how to delete the database from sqlite?

  • @Hari-xu1zb
    @Hari-xu1zb Год назад +1

    How to get example.db file path? and how to example.db file open DB browser for Sqlite tool

  • @desainad
    @desainad Год назад

    Under which folder does it store the database? If I have to select from an existing database, where should I place this in the project folder? I am using Windows 10.

    • @Sparrow-tn9jj
      @Sparrow-tn9jj Год назад

      import * as FileSystem from 'expo-file-system'
      const FOLDER_PATH = `${FileSystem.documentDirectory}`

  • @sherlockbhone5268
    @sherlockbhone5268 Год назад

    Thank you, you are a Sage , may you be prosperous and happy

  • @realworldcodingapplications
    @realworldcodingapplications Год назад

    awesome, learned a lot from this, first time working w database for mobile app! very cool

  • @zelvrs
    @zelvrs Месяц назад

    please make import and export sqlite for wal mode cause i've already set the mode to wal mode and now i've got 3 different file .db, -wal, and -shm 🙏

  • @nunomonteiro9808
    @nunomonteiro9808 6 месяцев назад +1

    for some reason, i did like you, but i can't get the names from database....

  • @veleskarlsruhe
    @veleskarlsruhe Год назад +2

    Hi MissCoding, thank for the video. I was looking for a longer time how do I integrate an SQLite into React Native Expo app. And finally came across to you :).
    I have an issue TypeError: undefined is not an object (evaluating 'ExponentSQLite.exec') when running the app locally (Windows). On the Snack it runs fine.
    Do you have any idea what it could be? On the internet is only one (?!) post on this topic, which does not have the solution for an expo managed workflow.

    • @veleskarlsruhe
      @veleskarlsruhe Год назад

      Hi again, I solved the issue "ExponentSQLite.exec" by myself.
      It was about running "npx expo start" in the GitBash-Terminal. As soon as I started the terminal out of the Visual Studio Code everything was fine. I am using the Android simulator

    • @Evalionn
      @Evalionn Год назад

      Hii
      Did you build your app for release?

    • @veleskarlsruhe
      @veleskarlsruhe Год назад

      @@Evalionn Hi, no, I am not that far yet.

  • @emmanuelareiza9699
    @emmanuelareiza9699 5 месяцев назад

    Thanks bro suchs a great video you made , Greates wishes from COLOMBIA

  • @andrejkling3886
    @andrejkling3886 3 месяца назад +1

    Excellent tutorial… thank you 💯

  • @henriqueantonio3019
    @henriqueantonio3019 9 месяцев назад

    Thank you very much, here from Brazil :)))

  • @AlejandroHernandez-mh5om
    @AlejandroHernandez-mh5om Год назад

    Hello, thank you very much for your tutorial, it is excellent, but I have an error and I don't know what it refers to:
    [Error: no such table: names (Sqlite code 1 SQLITE_ERROR): , while compiling: SELECT * FROM names, (OS error - 2:No such file or directory)]
    Could anyone help me

    • @anyahayes3601
      @anyahayes3601 Год назад

      Can you show the code surrounding your select statement?

    • @AlejandroHernandez-mh5om
      @AlejandroHernandez-mh5om Год назад

      @@anyahayes3601 Hello, thank you for answering, but I have already been able to see what happened, it was my mistake when writing the statement to create the table. Apologies.

    • @nazmossakib2540
      @nazmossakib2540 Год назад

      @@AlejandroHernandez-mh5om I am facing the same problem....can u please help me to fix this?

  • @tienphanmemtinh8207
    @tienphanmemtinh8207 6 месяцев назад

    Can you share this demo code ?

  • @Sparrow-tn9jj
    @Sparrow-tn9jj Год назад

    Nice tutorial. Thank you very much

  • @mrwenr0347
    @mrwenr0347 Год назад

    Thank you! Very helpful video!❤

  • @kingogamer4358
    @kingogamer4358 Год назад

    Can you upload a video on expo in app purchase how to do that thanks in advance

  • @chrisnk7066
    @chrisnk7066 Год назад

    Unable to resolve "expo-sqite"

  • @ricardoyanez9464
    @ricardoyanez9464 Год назад

    wow! awesome video, thanks. Good voice.

  • @Lee95pl
    @Lee95pl Год назад

    Hey! Thanks for the video, very informative :) It seems that link to your repo is broken.

    • @MissCoding
      @MissCoding  Год назад +2

      Thank you very much, I accidentally had it as private but I’ve fixed that now :)

  • @erdincparlak7092
    @erdincparlak7092 Год назад

    Teşekkürler. Çok güzel bir bir anlatım.

  • @draigan
    @draigan Год назад

    why does your filetree take up half the screen so u have to keep going back and fourth...

    • @mikhailman
      @mikhailman Год назад +2

      The person is creating a free tutorial on a specific topic helping others with their developer journeys for nothing in return, and the only thing you could come up with is a half-assed critique of their IDE layout? Pathetic.

  • @QianZhiwei
    @QianZhiwei 4 месяца назад

    Cool! Thank you!

  • @neerajtangariya4067
    @neerajtangariya4067 Год назад

    Hey hi , Nice video.
    In this demo application you've used the expo-sqlite.
    what if I prefer to use this npm package instead of expo-sqlite?
    react-native-sqlite-storage
    because if i use the react native with cli then we have to do lot of configuration with expo in bare application.

  • @argames1578
    @argames1578 6 месяцев назад

    Great Video thank you very much :)

  • @alirezascript
    @alirezascript 2 месяца назад

    Thanks for that

  • @programmingwithnit5308
    @programmingwithnit5308 Год назад

    Thank you so much 🎉❤

  • @johnkumar958
    @johnkumar958 7 месяцев назад

    Very useful

  • @9alotaibi
    @9alotaibi Год назад

    Greate Work Thank you

  • @yassinesaid4687
    @yassinesaid4687 Год назад

    Thank ya sis

  • @amiribrahim01
    @amiribrahim01 Год назад

    thank you

  • @xgcwrought3346
    @xgcwrought3346 5 месяцев назад

    Love the content wanna network on linkdin?

  • @carloojeda-e1e
    @carloojeda-e1e 8 месяцев назад

    What a waste of time

  • @espial5789
    @espial5789 10 месяцев назад

    Hello, I really liked the video.
    I ask you a question, I am trying to create 2 tables in the same transaction, is this possible?
    I do the following:
    const db = SQLite.openDatabase('acm1pt.db');
    var sql = `
    CREATE TABLE IF NOT EXISTS users (
    guid INTEGER PRIMARY KEY AUTOINCREMENT,
    id TEXT,
    user_name TEXT,
    session TEXT,
    date_init TEXT
    );
    CREATE TABLE IF NOT EXISTS orders (
    guid INTEGER PRIMARY KEY AUTOINCREMENT,
    id TEXT,
    account_id TEXT,
    account_name TEXT,
    case_number TEXT
    );
    `;
    db.transaction(tx => {
    tx.executeSql(sql, [], (tx, result) => {
    resolve('The database was created ' + name + ' en ' + dbPath);
    }, (error) => {
    reject('Error executing SQL query - Error: ' + error.message);
    });

    });
    Only the first table is created and the second one is not created....