Configure Multiple DataSource using Spring Boot and Spring Data | Java Techie

Поділитися
Вставка
  • Опубліковано 6 лис 2024

КОМЕНТАРІ • 258

  • @Kiran-uq8lw
    @Kiran-uq8lw Рік тому +1

    Thank you, brother, on July 25th, 2023 at 2:15 AM in the United States you solved my problem. Thanks for this video. Wish you all good.

  • @sonujadon3255
    @sonujadon3255 6 років тому +3

    interview point of view this video is very important , those who wants the Resume Spring Boot

  • @arnobchowdhury3191
    @arnobchowdhury3191 3 роки тому +13

    Sir, you can put a payment link for donation, you are doing a lot good for free and you deserve something in return.

    • @veenatiwari4794
      @veenatiwari4794 3 роки тому +2

      Agreed with you and .. hands up to his efforts 🙏

  • @vinitgawali1
    @vinitgawali1 2 роки тому +1

    Awesome this is exactly what i was looking for. This question asked me in interview repeatedly

  • @Shafmohaa
    @Shafmohaa 2 роки тому +2

    Thank you, 4 years old but still works

  • @deepakkasturirangan4383
    @deepakkasturirangan4383 4 роки тому +1

    Datasource are mapped using keys with domain-name (from 7.09)
    Syntax: "spring...url = xxx"
    instead of "spring..url = xxx"

  • @vijayakumarkrishnan9269
    @vijayakumarkrishnan9269 5 років тому +1

    Thanks for the step by step execution dear Friend! Actually, I have downloaded a copy but it was not working for me. when I watched this video I corrected a few things in the code and it was working fantastically.

    • @Javatechie
      @Javatechie  5 років тому

      Thanks Vijaya , Could you please update here if you found any issue with same code

    • @vijayakumarkrishnan9269
      @vijayakumarkrishnan9269 5 років тому

      @@Javatechie I have downloaded some different Code friend. Not your code. Your code works seamlessly fine :)

    • @vijayakumarkrishnan9269
      @vijayakumarkrishnan9269 5 років тому

      However, I would like to know how to send data as a JSON to the endpoint? because what I could see is that passing the values to Model classes in a program itself. I want to know how to do it dynamically at run time with postman?

    • @Javatechie
      @Javatechie  5 років тому

      @@vijayakumarkrishnan9269 this is backend code that's why I tried with postman but if you want data in real time scenario then it should be pass through client (angular, Ajax)

    • @vijayakumarkrishnan9269
      @vijayakumarkrishnan9269 5 років тому

      @@Javatechie Yes, exactly, I have a client app which submits the data from a web form to backend endpoint via Ajax post. but would like to know how to process Ajax data in backend repository code or in the controller.

  • @nitsbobby
    @nitsbobby 5 років тому +2

    Thank you so much for sharing the knowledge on multiple datasource usage in MS.

  • @chilukabharath4809
    @chilukabharath4809 3 роки тому +1

    Nice Video could you please clarify the below points
    1. (23:24) in persistanceUnit("Book") we configure for one table entity, what if the db have some 10 tables how to configure all of them
    2. And you created Repository by extending Jparepository what if we want to interact with 10 tables in that Db.
    3. is there any way to configure EntityManager per datasource so that we can interact with all tables in that datasource?
    Please explain these points.

    • @Javatechie
      @Javatechie  3 роки тому

      For each table you need to create separate repo that's what database per service pattern in microservices

    • @chilukabharath4809
      @chilukabharath4809 3 роки тому

      @@Javatechie ok so i need to create 10 interfaces(Repositories).
      and is there any way to configure EntityManager per datasource?

  • @LOKESHPANDEYjob2014
    @LOKESHPANDEYjob2014 4 роки тому +1

    Just for the readers, hbm2ddl.auto=update is discouraged in production. Better use dbProperties.put("hibernate.hdm2ddl.auto", "validate");

  • @abidinberkay1
    @abidinberkay1 2 роки тому +2

    i didn't understand onepoint; there are two entityManagerFactory in 2 db config class. What if we have so many entity classes and repo classes in the project? do we need to create config file for every single model class that we have ?

    • @Javatechie
      @Javatechie  2 роки тому +1

      No if Entity belongs from same Database then in one entityManager configuration you can add those entity

  • @nagarjunagorantla3629
    @nagarjunagorantla3629 4 роки тому +2

    thanks for sharing the valueble info..How to connect with Maria DB and Mssql DB

    • @Javatechie
      @Javatechie  4 роки тому +1

      Just change datasource properties that's it

  • @veenatiwari8621
    @veenatiwari8621 3 роки тому +4

    Thank you so much sir for your hard efforts for us to make us with easy learn. Awesome and very helpful videos and you also explain the concept very well. Thanks , i took reference of your this code and videos to implement my task, now i need to connect my API with 3 database as @primary will help for between two database .. as for three database i am getting , how i can mange it with qualifier or any other ways for the same. Thanks for your hard efforts as you bring knowledgeable videos. Thanks.

    • @Javatechie
      @Javatechie  3 роки тому +2

      Thanks Veena ,
      What difficulty you are facing while connect to 3 different datasource however approach is same

  • @surjeetmohanty4214
    @surjeetmohanty4214 5 років тому +4

    This tutorial actually i am looking for.Thanku.

  • @narendarreddy3158
    @narendarreddy3158 6 років тому +3

    Nice video basanth.. How @configurationproperties() working here.. because in properties file the prefix is (spring. User........) but in your config class you mentioned pring.user... how the data source were created in your application. Check at time about 12:19 .. nice video..

    • @Javatechie
      @Javatechie  6 років тому +1

      Hey Narendra yeah it should be spring ,latter I changed spell before run

    • @narendarreddy3158
      @narendarreddy3158 6 років тому

      @@Javatechie ohh.. Okay

    • @nageswararaopalchuri3003
      @nageswararaopalchuri3003 6 років тому +1

      What is the use of writing the spring.autoconfigure.exclude in properties file

    • @Javatechie
      @Javatechie  6 років тому +3

      @@nageswararaopalchuri3003 you can ignore it ,I just used it to disable all the database related auto configuration as I configured manually using java base config approach

  • @djamelzerrouki5254
    @djamelzerrouki5254 5 років тому +3

    Thank you for this tutorial I am very happy

    • @Javatechie
      @Javatechie  5 років тому +1

      That's what I did here , two database means definitely we need to configure two different datadource .
      Let me know your doubts with more info

    • @djamelzerrouki5254
      @djamelzerrouki5254 5 років тому

      @@Javatechie my Question is how you can create a new datasource at runtime by controller web by generated code . " programmatically and dynamic "

    • @Javatechie
      @Javatechie  5 років тому +2

      We are manually creating datasource specific to database then we are adding required configuration stuff
      Once our datasource created we are mapping it to entity manager .

    • @djamelzerrouki5254
      @djamelzerrouki5254 5 років тому

      @@Javatechie Thanks sir, I know what I did but can you help me do this work? Or guide me something in this problem

  • @gokulaher2476
    @gokulaher2476 3 роки тому

    Very nice Explanation..
    Requesting you to pl. make a similar 30 minute video including code example for distributed transaction management using Spring Boot microservice. Thanks!

  • @LaVerguenzaDeTwitch
    @LaVerguenzaDeTwitch 4 роки тому +1

    thanks so much for your tutorial.
    now i have question, if i have more than one entity in both datasource, what changes i need to do and where?

    • @Javatechie
      @Javatechie  4 роки тому +2

      You only need to create additional repository later that's it

    • @LaVerguenzaDeTwitch
      @LaVerguenzaDeTwitch 4 роки тому +2

      @@Javatechie Nice, this works for me, i love you

  • @pavankumar-si2jv
    @pavankumar-si2jv 5 років тому +3

    Do we have to add configuration class for every entity in the project? Lets say there are 10 entity classes?

    • @Javatechie
      @Javatechie  5 років тому +1

      Only configuration required for data source not for entity pavan

    • @pavankumar-si2jv
      @pavankumar-si2jv 5 років тому +1

      @@Javatechie You have used persistent Unit name as "User' . So my question was what if there are 10 entitites. ? Should should write configuration for all 10 entities as persistant Unit?

    • @Javatechie
      @Javatechie  5 років тому +1

      Pavan in one configuration we can mention multiple entity . this what the small poc .

  • @profindia
    @profindia 3 роки тому +1

    Thanks for this video. One small query, if i have one more entity, say UserAddress, then how would i indicate this in the userconfig class?

    • @Javatechie
      @Javatechie  3 роки тому

      We can setClasses in spring config class only as I can't remember the syntax now .

  • @arnobchowdhury3191
    @arnobchowdhury3191 3 роки тому +1

    Love java tikki.. Great job

    • @Javatechie
      @Javatechie  3 роки тому +1

      Typo javatechie 🤪, anyway thanks

  • @tw5529
    @tw5529 4 роки тому +1

    Very nice explanation. Keep it up. Can't we keep both user and book repository interfaces in a single package instead of keeping in 2 different packages??

    • @Javatechie
      @Javatechie  4 роки тому +2

      No not possible you will get exptception so we should follow the hierarchy

    • @tw5529
      @tw5529 4 роки тому

      @@JavatechieThank You so much for your quick response 😊👍. may I know the reason....why it's not possible?

  • @rupalilokhande2656
    @rupalilokhande2656 4 роки тому +2

    Awesome :) Exactly what I am looking for :) Thanks a lot With the reference of this I am able to integrate Spring boot with MySQL and Neo4j repositories at the same time.

  • @sabyasachimondal04
    @sabyasachimondal04 4 роки тому +1

    Thanks for the video. Can you please make a video showing Springboot Application which will be deployed to Weblogic Server and connect to a JNDI datasource which is already created in weblogic server. Thanks in advance.

  • @prasenjitmukherjee3654
    @prasenjitmukherjee3654 3 роки тому

    Mind-blowing. Can you make a tutorial on Mule

  • @boikimphore7845
    @boikimphore7845 3 роки тому +1

    Great tutorial, it has helped me with one of the most important tasks I had to do.

  • @nagarjunareddykanala9318
    @nagarjunareddykanala9318 6 років тому +1

    Thanks for the video it's clear and useful for attending interviews

  • @kuldeepsahoo1602
    @kuldeepsahoo1602 5 років тому +1

    Bhai mast heichhi video ta

  • @ElonMusk-wo7zf
    @ElonMusk-wo7zf 2 роки тому +1

    Bro. Please do a tutorial on Multi-tenancy in spring boot.

  • @alisheratadjanov3747
    @alisheratadjanov3747 2 роки тому +1

    Thanks. Awesome and helpful

  • @daredevone
    @daredevone 4 роки тому +1

    Good stuff! It seems like multiple schemas are also accessible with the same datasource only by putting different usernames. Thanks.

    • @Javatechie
      @Javatechie  4 роки тому

      Not by username , you can say schema name

  • @saranyanatarajan9340
    @saranyanatarajan9340 11 місяців тому +1

    Hi sir good explanation, I am having a doubt I need to connect different schemas like user model has separate user schema and book model has separate book schema but both are in sql database , may i use this same configuration for this task and also should i create a separate separate packages for both "pls reply "

    • @Javatechie
      @Javatechie  11 місяців тому

      Yes you can follow the same only change the schema name in the URL in the application.properties

    • @ProgrammingRJPT
      @ProgrammingRJPT 8 місяців тому

      @@Javatechie Is there any way we can pass dynamic schema name rather than hardcoding in application.properties? let's say adding new schema for any new client enrolled to system. Thanks in advance!

  • @saikatkoley5976
    @saikatkoley5976 2 роки тому +1

    Excellent, it really helped a lot.

  • @malleswarrao3887
    @malleswarrao3887 Рік тому +1

    Can you please give explanation for distributed transactions in spring microservices

    • @Javatechie
      @Javatechie  Рік тому

      Already i uploaded videos on it . check saga choreography

  • @Roma4086
    @Roma4086 2 роки тому +1

    very helpful. thank you for video

  • @LolLol-bb5cx
    @LolLol-bb5cx 6 місяців тому

    Hi, Java Techi, Thank you for your video, I have a doubt I configured just like you with customer and order in two different DB and they are in one to many relation so when I set scan packages to com.example in config I'am able to create table but all tables are getting created in both DB how do I resolve that and make to create only one table in each DB

  • @nagarjunareddykanala9318
    @nagarjunareddykanala9318 6 років тому +2

    Very helpful Basant super

  • @sravanreddymatta5381
    @sravanreddymatta5381 4 роки тому +1

    There you mentioned persistent entity as User And Book. What should I mention of I have more than 5 entities in that model packages.

    • @Javatechie
      @Javatechie  4 роки тому

      Can you explain your complete scenario

    • @sravanreddymatta5381
      @sravanreddymatta5381 4 роки тому

      @@Javatechie what is that persistent()?. There you mentioned entity name. But what about if we have multiple entities. How do I mention entities to that persistent.

  • @dhruvarnav86
    @dhruvarnav86 Рік тому +1

    Hi, Can we join two tables from different databses? Say employee is in oracle DB and Department in mysql DB.
    I dont want to join inside service but want to join in repo using jpql.

    • @Javatechie
      @Javatechie  Рік тому

      I don't think we can do that but let me try and update you

  • @saadmohammed6062
    @saadmohammed6062 4 роки тому +2

    I have one doubt?
    I have two schemas
    work -> customer_table
    work2 -> customer_table
    how can I call dynamically for different schemas?
    I have one POJO class and one repository, how to change the table name dynamically.

    • @Javatechie
      @Javatechie  4 роки тому

      Is both schema comes under same datasource?

    • @saadmohammed6062
      @saadmohammed6062 4 роки тому

      @@Javatechie Yes, But we have to write two resources,
      such as localhost:8080/work/customer1
      and localhost:8080/work/customer2

    • @Javatechie
      @Javatechie  4 роки тому

      @@saadmohammed6062 hi could you please elaborate bit more
      With this 2 resource what you want to achieve

    • @saadmohammed6062
      @saadmohammed6062 4 роки тому +1

      @@Javatechie I have two schemas in MySQL.
      work1 and work2 each have a customer table.
      How to call them dynamically at runtime.

  • @SatyamKumar-mq3qf
    @SatyamKumar-mq3qf 6 років тому +3

    thank you basant bhaiya

  • @jaydeepchauhan429
    @jaydeepchauhan429 2 роки тому

    How to get all suggestions like you did when write classes name...?
    I am also using Eclips

  • @nareshe9906
    @nareshe9906 Рік тому

    hi, you tightly coupled specific model/entity class .If we have more than one table/entity how to configure.?

  • @dinobulja
    @dinobulja 2 роки тому

    How about using different database vendors? How would you set then multiple data bases? And database dialects?

  • @artnum-rdc2015
    @artnum-rdc2015 4 роки тому +1

    very good! how about synchronisation between remote database and local db?

    • @Javatechie
      @Javatechie  4 роки тому

      Hi John , didn't get you

    • @artnum-rdc2015
      @artnum-rdc2015 4 роки тому +1

      @@Javatechie if i have a remote database and the same database is on localhost how to synchronise data between the remote and locahost!

    • @Javatechie
      @Javatechie  4 роки тому +2

      @@artnum-rdc2015 am not sure but yes I did something like below
      Take DB dump of your remote DB then import it in your local or just point your local DB to remote host .
      So that both info can be on sync

    • @artnum-rdc2015
      @artnum-rdc2015 4 роки тому +1

      @@Javatechie thanks you!

  • @pncabhsiek3311
    @pncabhsiek3311 4 роки тому +2

    What about rollback Trx 1 on failure of Trx 2 in two different databases.

    • @Javatechie
      @Javatechie  4 роки тому +1

      As far I understand we can't apply transaction on database level it should be Table level correct me if am wrong

    • @pncabhsiek3311
      @pncabhsiek3311 4 роки тому +1

      Yes it's on table level. But what If I have to achieve a common/ global transaction on two diff tables...
      Example: a distributed Trx mgmt, if there are two tables(say db1.table1 and db2.table2).. but using single Trx.
      Like, if amount debited from db1.SBI table is successful. But credit in db2.hdfc table is failed. Then it should rollback. And SBI refund should be there.
      so if you can demo using Hibernate Jpa and spring boot. It would be great.

    • @Javatechie
      @Javatechie  4 роки тому +1

      @@pncabhsiek3311 I was also searching this pattarn but didn't succeed yet .I will update you once I do

    • @7doorshr598
      @7doorshr598 2 роки тому

      @@Javatechie Hello dear, have you find any valuable information of the @pnc abhsiek question ?

  • @kalaivanisundaram3842
    @kalaivanisundaram3842 4 роки тому +1

    Hi, I Need your advice here.
    I’m building a web application which allows users to choose database (HK,UK,US) from the UI. Based on his selection of databases, I need to connect to respective DB instance in the spring boot + Jpa. Please share your thoughts!

    • @Javatechie
      @Javatechie  4 роки тому +1

      We can do one thing
      Based on UI input we will enable profile for region rather than environment
      Let's se I chooses UK then from application we will setActiveprofile to UK so that corresponding datasource properties will be loaded .
      Do let me know if you have any issue.
      Very interesting concept

  • @veenatiwari4794
    @veenatiwari4794 3 роки тому

    Thanks for this wonderful video..it's so helpful.. Awesome way of explaining.. thanks for your efforts for us learners... Sir I have one question... without @Entity class we can connect to data base..as I need to fire queries..having different table...how I can do that.. please suggest.. I don't want to create table in db ..but want to retrieve data from different table...in case..I don't need that that Entity class created..I made dto..to fetch the data....but..how I can do..can you please suggest

    • @veenatiwari4794
      @veenatiwari4794 3 роки тому +1

      How I can connect to multiple database without..@Entity class creation..as we don't need any creations

    • @Javatechie
      @Javatechie  3 роки тому

      Thanks man , Need to check this

    • @veenatiwari4794
      @veenatiwari4794 3 роки тому

      @@Javatechie thanks sir..heads up to your efforts

  • @prithvikrishna1164
    @prithvikrishna1164 3 роки тому +1

    Hi @Java Techie
    Can we Datasource-1 for Multiple repositories?
    Example:
    I am having two Data Sources DS-1, DS-2
    DS-1 contains Books, NewsPaper, Notes, Ref-Materials, etc tables,
    Whereas DS-2 contains transactions of users.
    It's Possible to connect DS-1 with Multiple Repo?

    • @Javatechie
      @Javatechie  3 роки тому

      Yes we can

    • @prithvikrishna1164
      @prithvikrishna1164 3 роки тому

      @JavaTechie Thanks for the quick reply. If possible can you share any demo projects or video for reference.

  • @Shafmohaa
    @Shafmohaa 2 роки тому

    I have 2 schemas, and both are identical (they are just replicas), do I still need to maintain 2 different models and repositories? Or can the basePackages be the same?

  • @MuhammadKhan-vb8jl
    @MuhammadKhan-vb8jl 4 роки тому

    we have created two data sources each data source has one table, what if we have more tables in each data source, how we create entities and how we bind to particular data source?

  • @sathishKumar-ft2ij
    @sathishKumar-ft2ij 3 роки тому

    Hi, i am also using the same context. could you let me know how shall i handle the exception if any one of the db is down or table not exist?

  • @priyankawagh5217
    @priyankawagh5217 4 роки тому +2

    Excellent!!

  • @hiteshupreti4250
    @hiteshupreti4250 3 роки тому +1

    Why separate config for each entity ... can't it be done on single config class .. as in real time we will be having multiple entities so i don't think it's good practise to create separate config for each entity. Any suggestion on that

    • @Javatechie
      @Javatechie  3 роки тому

      As there is two datasource we need to configure that in different config . As one of them we are making primary

    • @hiteshupreti4250
      @hiteshupreti4250 3 роки тому

      So can't we configure more than 1 datasources in 1 config file only ... that's my question

    • @Javatechie
      @Javatechie  3 роки тому

      No we can't Hitesh

  • @mars4219
    @mars4219 3 роки тому +1

    Thanks a lot, you are the best!!!

  • @skipa9906
    @skipa9906 2 роки тому +1

    Hi. how can I Sync the two databases? when database A is updated then Database B gets automatically updated?

    • @Javatechie
      @Javatechie  2 роки тому +1

      Not sure will check and update

    • @skipa9906
      @skipa9906 2 роки тому

      @@Javatechie that would be gladly appreciated, thank you.

  • @tarikhamlat6024
    @tarikhamlat6024 5 років тому +1

    Thank you for this video, but how i can use three data source ? the anotation @Primary don't work if we have three data source

    • @Javatechie
      @Javatechie  5 років тому

      Hi Tarik , thank you
      Yes it will work with N number of DB , but at same time I don't think we can use it

  • @pavithraakp2067
    @pavithraakp2067 6 місяців тому

    Hello Basant, how do we connect more than one table ? could you please answer my question

  • @shridharabm5793
    @shridharabm5793 4 роки тому +1

    hi sir,
    its more informative can u please share us for same as for NO SQL databases

    • @Javatechie
      @Javatechie  4 роки тому +2

      I don't think we need datasource configuration for NoSQL DB
      But I will show one demo with multiple NoSQL config in single application

    • @shridharabm5793
      @shridharabm5793 4 роки тому

      @@Javatechie thanks for your response....

  • @vihariv3829
    @vihariv3829 3 роки тому +1

    always your super sir

  • @deepakkasgar5954
    @deepakkasgar5954 3 роки тому

    Hi, I have downloaded the code from git and tried to execute. Its creating both the tables in one schema only. Any idea why so? I also have to add few properties in POM.xml to make it work

  • @neha6000
    @neha6000 2 роки тому +1

    Best 😘

  • @noumaanmohammad1274
    @noumaanmohammad1274 3 роки тому +1

    Nice video ... Can we able to join two entities from different datasources and fetching selected columns from both the entities ? is it possible ?
    Eg : joining User with Book with foreign key and fetching username,bookname after joining.

    • @Javatechie
      @Javatechie  3 роки тому +1

      This is not valid scenario at all because wrong design

    • @noumaanmohammad1274
      @noumaanmohammad1274 3 роки тому +1

      @@Javatechie ..sorry , i meant for different schemas in oracle from the same databse... is it possible ?

    • @Javatechie
      @Javatechie  3 роки тому +1

      Yes absolutely possible , you can just follow this approach also please refer my onetomany association mapping tutorial

    • @noumaanmohammad1274
      @noumaanmohammad1274 3 роки тому

      @@Javatechie Thank you ❤️ .

  • @akashrathor9863
    @akashrathor9863 2 роки тому +1

    If I have 100+ tables in both the DB's then I have to make 100+ config classes for both DB ?
    Is there any smart way of doing this ?

    • @Javatechie
      @Javatechie  2 роки тому

      Configuration not required for table it need for database

  • @akshaysachdeva6401
    @akshaysachdeva6401 5 років тому

    Hi, really nice video.
    Is this also the way to achieve dynamic data source routing?
    If in the payload we getting which database we require to query/update.
    Will this be an optimum way to do it?

    • @Javatechie
      @Javatechie  5 років тому +1

      Akshya that's why we created two repository right ?
      Based on your payload choose the appropriate repository and populate the data

  • @OdiaMadBiker
    @OdiaMadBiker 4 роки тому

    These are only fr specific 2 domain class user and book..if in case we need to use multiple domain class...then how can we maintain in package basis

  • @anil2009
    @anil2009 4 роки тому +1

    Lombok is not working in my Eclipse ide although I have mentioned in dependencies sir. could you please tell me what may be the problem

    • @Javatechie
      @Javatechie  4 роки тому

      You need to configure it in your IDE , adding dependency is not enough
      Please go through my blog and search you will get steps to configure Lombok

  • @obsessed394
    @obsessed394 3 роки тому

    Can we do Master slave data source configuration similar way for one is for write and other is for read

  • @isurumw6119
    @isurumw6119 Рік тому

    I have multiple entities in the same package. What should I do?

  • @curiouspragyan1938
    @curiouspragyan1938 2 роки тому +1

    Thank you so much sir

  • @yaminin6487
    @yaminin6487 3 роки тому +1

    Amazing 🙏

  • @obempa
    @obempa 3 роки тому

    Any suggestions on how to connect to Postgres and MongoDB?

  • @maneeshsingh1325
    @maneeshsingh1325 4 роки тому

    can you please instruct me how to set different Hikari properties for the different database

  • @VikramKumar-ou3lh
    @VikramKumar-ou3lh 3 роки тому

    while adding Hikari config I am getting : HikariPool-1 - dataSource or dataSourceClassName or jdbcUrl is required.

  • @hanumanthram6754
    @hanumanthram6754 Рік тому

    Getting error: Parameter 0 of method studentEntityManagerFactory in com.school.config.StudentsDataSourceConfig required a bean of type 'org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder' that could not be found.
    Action:
    Consider defining a bean of type 'org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder' in your configuration.

  • @jeremiahchang8403
    @jeremiahchang8403 4 роки тому +1

    找了很多教程都不行,这个ok,thanks!

  • @tahirkhalifa123
    @tahirkhalifa123 3 роки тому

    great tutorial but where the oracle configration

  • @pratapjavasingh3239
    @pratapjavasingh3239 6 років тому +1

    Great JOb Basant BHi :)

  • @Shafmohaa
    @Shafmohaa 2 роки тому +1

    Thanks!

  • @hardiktiwari1808
    @hardiktiwari1808 3 роки тому +1

    how to connect h2 and my sql database in one spring boot application
    Weather the same method will work ?

    • @Javatechie
      @Javatechie  3 роки тому

      Did you tried it before ?
      Are you getting any issue?

    • @hardiktiwari1808
      @hardiktiwari1808 3 роки тому

      @@Javatechie till now not tried but in my project requirement i have to do it . So was asking weather this method will work for h2 database also .

    • @hardiktiwari1808
      @hardiktiwari1808 3 роки тому +1

      @@Javatechie i have to integrate h2 and sql database in one application weather it will work ?

    • @Javatechie
      @Javatechie  3 роки тому

      It will work in that case you don't need to configure this spring config class only you need to add in properties file .

  • @bareetsingh
    @bareetsingh 3 роки тому +1

    Thank you, so much.

  • @vishnumurali522
    @vishnumurali522 4 роки тому +1

    What is the persistence unit and if I have 20 model class in package
    Can I work like this?

    • @Javatechie
      @Javatechie  4 роки тому

      Yes you can no issues on that

    • @vishnumurali522
      @vishnumurali522 4 роки тому

      U give input like user and book to the value of the persistence unit
      So is it means name of the model class
      If it is yes how can I give all model for that..

    • @Javatechie
      @Javatechie  4 роки тому +2

      Dude please watch from begin
      I mentioned there as I don't have multiple databases install in my machine am giving example using two different entity
      Let's say I have Oracle and MySQL
      Oracle db I can configure N number of entity similarly for Oracle I can configure N number of entity
      Because in one database we xan have multiple entity
      If you have multiple DB in your machine then please try configure it and see
      I Just configure 2 schema to show demo how to configure in case data source .

  • @LucaDallaVecchia
    @LucaDallaVecchia 5 років тому +2

    It works!!!!!!

  • @WeekendCharger
    @WeekendCharger 3 роки тому +1

    Great

  • @ajaydhiman2368
    @ajaydhiman2368 4 роки тому +1

    I'm getting lots of exceptions - dependencies are missing. can you share the POM.xml for this application.

    • @Javatechie
      @Javatechie  4 роки тому

      GitHub link mentioned in video description

  • @reginaldospricigo7955
    @reginaldospricigo7955 4 роки тому

    Great! Thanks for sharing.

  • @anveshkasarla8456
    @anveshkasarla8456 2 роки тому +1

    Can we migrate data from mysql to psql or psql to mysql.

  • @alekhyateja7420
    @alekhyateja7420 5 років тому

    bro,can you do video on how to configure multiple datasources using JpaBaseConfiguration

  • @akshatpandey2256
    @akshatpandey2256 5 років тому +2

    Does it work the same if i have to MongoDB databases?

    • @Javatechie
      @Javatechie  5 років тому +1

      While configuring NoSQL DB (mongo,cassandra,neo4j) we are not giving datasource details

    • @akshatpandey2256
      @akshatpandey2256 5 років тому

      @@Javatechie Rest all is exactly same? Can i follow this tutorial and set up my mongodb connection successfully?

    • @Javatechie
      @Javatechie  5 років тому

      @@akshatpandey2256 yes you can , already I created one repo with MySQL and mongo .

    • @bhanubill
      @bhanubill 4 роки тому

      @@Javatechie @Akshat Pandey, could you please send share your code how u configured mysql and mongo in single application. I'm facing problem with mysql+mongodb databases combination

    • @Javatechie
      @Javatechie  4 роки тому

      @@bhanubill please refer below POC github.com/Java-Gyan-Mantra/multiple-db-connection

  • @deepakkasturirangan4383
    @deepakkasturirangan4383 4 роки тому

    Use a separate DB Config for each domains and create separate EntityManagerFactoryBean using EntityManagerFactoryBuilder (as shown @ 15.36)

    • @Javatechie
      @Javatechie  2 роки тому

      Yes it's not straight forward

  • @rohitkumarsah77
    @rohitkumarsah77 3 роки тому

    Suppose there are two entities for a database and two entities for another...how to cater that

  • @praneethyaji7808
    @praneethyaji7808 4 роки тому +1

    I want to update if there are any differences in data.is that possible??

    • @Javatechie
      @Javatechie  4 роки тому +1

      You want to update record ? If any field changed right ?
      So first you need to get existing object from dB then set the new value to object next save it

    • @praneethyaji7808
      @praneethyaji7808 4 роки тому +1

      @@Javatechiethanks for the reply. there are 2 lakhs record in both tables. I have to compare every row right?if so Is jpa is the best way?

    • @Javatechie
      @Javatechie  4 роки тому +1

      No for this jpa is not fisible solution to use .
      You need to to customize your query.looks interesting scenario
      Let me think if I can help you

  • @ilykna2396
    @ilykna2396 2 роки тому

    How to add schema dynamically to DataSourceBuilder ??

  • @radhapandikunta3819
    @radhapandikunta3819 3 роки тому +1

    Iam using Oracle it is throwing exception like jdbcurl is required with driver class name can u plz help me thanks in advance

    • @Javatechie
      @Javatechie  3 роки тому

      Didn't you configure in your application.properies file

    • @radhapandikunta3819
      @radhapandikunta3819 3 роки тому +1

      @@Javatechie I have used what u given everything I followed can plz help showing jdbc required driver class like that showing

    • @Javatechie
      @Javatechie  3 роки тому

      For Oracle you need to configure valid
      Datasource information in your application.properies am explained with two MySQL instance only

    • @radhapandikunta3819
      @radhapandikunta3819 3 роки тому

      @@Javatechie can u tell those configurations sir

    • @radhapandikunta3819
      @radhapandikunta3819 3 роки тому +1

      I have changed related to Oracle but showing driver class required jdbc url like that where I should change can u tell

  • @OmPrakash-dt2pu
    @OmPrakash-dt2pu 3 роки тому

    How will add 3 DB, primary will be only one?

  • @2RAJ21
    @2RAJ21 3 місяці тому +1

    Thank you.

  • @bsagar7440
    @bsagar7440 4 роки тому +1

    Can any one help .if i want create multiple table at time in multiple data source. then i how to use persistUnit.

    • @Javatechie
      @Javatechie  4 роки тому

      Raj I will check and update

  • @moajjamali6369
    @moajjamali6369 4 роки тому +1

    Cooolll

  • @Jesus-theWay-theTruth-theLife
    @Jesus-theWay-theTruth-theLife 2 роки тому

    I am getting error executing ddl "alter table" via JDBC statement

  • @hc5950
    @hc5950 5 років тому +1

    nice tutorial