Connect MySQL Database with Java (JDBC) in VS Code.

  Рет қаралды 97,314

Innovator

Innovator

Күн бұрын

Пікірлер: 148
@harshith_takkala
@harshith_takkala 3 жыл бұрын
As many of them are getting the issues regarding the ERROR: java.lang.ClassNotFoundException: I would like share few points. May be: 1. You haven't imported the correct jar file (jdbc driver from MySQL Installation) 2. Try to clear the workspace cache in VS Code. (don't know how but sometimes VS Code recommends me to do by a notification) 3. Restart the whole procedure... 4. Replace the statement "Class.forName("com.mysql.jdbc.Driver");" to "Class.forName("com.mysql.cj.jdbc.Driver");" (suggestion given by VS Code terminal) Hope it helps. 5. Or the main reason can be, you may not set the path for MySQL bin folder in either system variables or user variables.. The file hierarchy that must be running currently in VS code must be as follows: ProjectName { .vscode { settings.json } lib { } src { App.java } README.md "Debugger for java" must be installed, so that "Run Java" option will be visible to compile and run. Hope it works. ✨😀
@DAOXINNo15
@DAOXINNo15 8 ай бұрын
what if we get this instead about PS C:\Users\user\Desktop\MySqlProject\FInalJBDC> PS C:\Users\user\Desktop\MySqlProject\FInalJBDC> ^C PS C:\Users\user\Desktop\MySqlProject\FInalJBDC> PS C:\Users\user\Desktop\MySqlProject\FInalJBDC> c:; cd I no longer got the error of this ava.lang.ClassNotFoundException: when I did the class change as you said and restart the project from scratch but I just get that with what I showed you above now instead of printing out the tables or anything
@janhavipimplikar6048
@janhavipimplikar6048 3 жыл бұрын
This explanation is a lifesaver! It was really difficult to find JDBC tutorials in VSCode but this one nailed it .Thanks a lot for uploading this video!
@ryansatriayudha
@ryansatriayudha Жыл бұрын
This video is very helpful. I have tried many times watching other videos but never work. This works well after many mistakes. Thank you very much! Best wishes from Thailand.
@FERRUM-ix5yk
@FERRUM-ix5yk 2 ай бұрын
is this a trap? 😂
@PrernaSharma-yl6ih
@PrernaSharma-yl6ih 6 ай бұрын
Thanks a lot😭, I was struggling in running this program for 2-3 hours.... Finally I got the solution while scrolling through the comments...Thanks once again..
@kiaehe6292
@kiaehe6292 4 жыл бұрын
thanks innovator, fyi for some of you guys out there, here are a couple of errors i got and their solution 1)The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. the solution is to change line 7 to :-Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/invoicing","username","password"); and change the 0 to 1 on line 12 jic.
@akshattrivedi4164
@akshattrivedi4164 7 ай бұрын
Great tutorial man 👍 Still working after 2 years!!
@TheOnlyShubh
@TheOnlyShubh 2 жыл бұрын
I am unable to find that ConnectorJ 3:42 after Installing MySql. Help Please
@harshith_takkala
@harshith_takkala 2 жыл бұрын
Then, please use MySQL installer that is already installed by the executable to download jar
@tinayetsinakwadi8906
@tinayetsinakwadi8906 4 жыл бұрын
Thank you so much my man. You are a life saver. You deserve many views. Ill try and share with as many people as possible.
@harshith_takkala
@harshith_takkala 4 жыл бұрын
Thanks !! Check out my other videos too!!
@arthurbttf
@arthurbttf 3 жыл бұрын
You are the boss! No one else has explained where this goddamned classpath was, you're a literal life saver!
@harshith_takkala
@harshith_takkala 4 жыл бұрын
Like if you find it useful. Cheers !!
@udaan878
@udaan878 2 жыл бұрын
i am facing an error in class.forname(in this loction )it is saying com.mysql.jbdc.Driver() doesnot exist. What should i do now ?????????
@harshith_takkala
@harshith_takkala 2 жыл бұрын
I think you havent included the driver jar file into the project.
@bagwanmohdhuzaif1263
@bagwanmohdhuzaif1263 3 жыл бұрын
Thanks I am trying to run the first jdbc program from last 5 to 6 and your vedio helped thanks so much it really helped
@EnzoLadriere
@EnzoLadriere Жыл бұрын
Hey ! Thanks for the tutorial but i have a question. Why its works with "Run java" and not with javac + java ?
@harshith_takkala
@harshith_takkala Жыл бұрын
It works, but we have to add some arguments in the command
@haveagreatday7051
@haveagreatday7051 Жыл бұрын
@@harshith_takkala I also have this question. What arguments need to be added to the command?
@harshith_takkala
@harshith_takkala Жыл бұрын
We set class path, then compile, then run it. stackoverflow.com/questions/25186557/how-to-compile-mysql-jdbc-driver-with-a-java-file-in-cmd
@crimson4706
@crimson4706 2 жыл бұрын
may i ask you how to show all the columns? i have three columns and it only showed one column
@harshith_takkala
@harshith_takkala 2 жыл бұрын
The query has to be "SELECT * FROM and also in the println statement inside the while loop, it must have same number of functions as that of columns to be printed with indices starting from 1.
@joanmambwe3521
@joanmambwe3521 4 ай бұрын
Hello, I'm having the error, 'java.sql.SQLException: Access denied for user 'USER'@'localhost' (using password: NO). How do i fix it?
@harshith_takkala
@harshith_takkala 4 ай бұрын
I am not sure exactly, check the configurations of mysql, maybe something you missed
@FERRUM-ix5yk
@FERRUM-ix5yk 2 ай бұрын
You probably ran it as administrator, which changes the path to the file
@wagnerdds
@wagnerdds 2 жыл бұрын
Thanks for your tutorial. It saved my life!
@ommule4999
@ommule4999 3 жыл бұрын
Just a small doubt, when I run the code its displaying the output in the debug console. Can u suggest a fix ?
@harshith_takkala
@harshith_takkala 3 жыл бұрын
The "Debugger for Java" extension is responsible for running and debugging a java program. May be: 1. You are clicking on "Debug Java" or "Debug" instead of "Run Java" or "Run" 2. May be you are clicking "F5" (shortcut for debugging the program). If not working, then I dont know, If you got the solution, please share here. 🙂
@soueuoctavio4281
@soueuoctavio4281 3 жыл бұрын
call KZbin translator I'm Brazilian. this was the Google translator who translated .Thank you
@harshith_takkala
@harshith_takkala 3 жыл бұрын
English ?
@soueuoctavio4281
@soueuoctavio4281 3 жыл бұрын
Brazil .português
@nisarg001
@nisarg001 3 жыл бұрын
Thank you so much bro. I was going to switch to ecllipse but you saved me.
@harshith_takkala
@harshith_takkala 3 жыл бұрын
😁😁 My job done, I was expecting a comment of one of this kind. Thanks!
@husnajaved7514
@husnajaved7514 4 жыл бұрын
I'm very grateful to you Sir!!You did it really well
@harshith_takkala
@harshith_takkala 4 жыл бұрын
Thankyou ! Check out my other videos too !
@adonathomas1395
@adonathomas1395 3 жыл бұрын
I am having an issue. I installed MySQL Installer and added connector via library. But is is showing error "java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver" . But I can see it in libraries. I also deleted and added the library again.Do you have any idea how to solve this ?
@harshith_takkala
@harshith_takkala 3 жыл бұрын
I think you are running the program with "Run code" extension. You have to run program with "Run Java" that comes from Java Test runner and Project manager extensions. Hope you get it.
@harshith_takkala
@harshith_takkala 3 жыл бұрын
May be: 1. You haven't imported the correct jar file (jdbc driver from MySQL Installation) 2. Try to clear the workspace cache in VS Code. (don't know how but sometimes VS Code recommends me to do by a notification) 3. Restart the whole procedure... 4. Replace the statement "Class.forName("com.mysql.jdbc.Driver");" to "Class.forName("com.mysql.cj.jdbc.Driver");" (suggestion given by VS Code terminal) Hope it helps. 5. Or the main reason can be, you may not set the path for MySQL bin folder in either system variables or user variables..
@harshith_takkala
@harshith_takkala 3 жыл бұрын
Was your error resolved?
@shreyashdhane6234
@shreyashdhane6234 3 жыл бұрын
@@harshith_takkala I had the same error, I tried "Run JAVA". it's working fine now😂 thanks, man.
@reemanfahaad
@reemanfahaad 2 жыл бұрын
what is the command for creating new database?
@harshith_takkala
@harshith_takkala 2 жыл бұрын
CREATE DATABASE You can refer to documentation or w3 schools for more information
@iam_a_sad_khan
@iam_a_sad_khan 3 жыл бұрын
I am getting an error. java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver. Can you help me out?
@harshith_takkala
@harshith_takkala 3 жыл бұрын
Please refer to the pinned comment.✌
@iam_a_sad_khan
@iam_a_sad_khan 3 жыл бұрын
@@harshith_takkala Thanks, I was compiling with javac earlier and it was giving me this error but then I compiled it with the "run java" in vs code and it worked. Thanks again.
@kushalbarot4991
@kushalbarot4991 2 жыл бұрын
@@iam_a_sad_khan kaise kia bhai mujhe b smjao
@faithfillstories
@faithfillstories 3 жыл бұрын
Broh I didn't got the file name javaprojects on the left side
@harshith_takkala
@harshith_takkala 3 жыл бұрын
It will come when you open VS code from projects root directory. Example: Projectname-> {src, lib, etc...}.
@harshmavani24
@harshmavani24 2 жыл бұрын
can you tell me please how to hide user credential or encrypt database connectivity root or password with help of . properties file
@harshith_takkala
@harshith_takkala 2 жыл бұрын
I too dont know May be you can search for that in maven repository and download the jar file and import it. Else, you can use a maven project setup to install automatically
@harshmavani24
@harshmavani24 2 жыл бұрын
@@harshith_takkala can you provide that repo ?
@harshith_takkala
@harshith_takkala 2 жыл бұрын
@@harshmavani24 yeah, just search maven central repository and you can get the maven configurations. You can also download jar files over there I guess.
@harshith_takkala
@harshith_takkala 2 жыл бұрын
@@harshmavani24 you can refer to my maven playlist where I made a simple maven project that contains setup of project jn vscode. There we can add our required configurations to download automatically with the help of xml loading.
@torrescle
@torrescle 4 жыл бұрын
The vs code for Fedora 33 do not allow me to select any folder or .jar file :(
@harshith_takkala
@harshith_takkala 4 жыл бұрын
I dont have any idea about that operating system.
@deliveryboy786
@deliveryboy786 2 ай бұрын
mera java project wala option nhi aa rha hai vs code mai kya kru?
@ZoomerApp
@ZoomerApp 6 ай бұрын
Well, thanks so much man. It actually worked for me!
@Bhavana_Bora
@Bhavana_Bora 3 жыл бұрын
I'm unable to locate these refrential libraries,Please help
@harshith_takkala
@harshith_takkala 3 жыл бұрын
When we create a java project, "JAVA PROJECT" named a world space is created. Under this space, there is a directory called "Referenced Libraries". It takes little bit time to create the workspace in VS code. If the work space is not created, then close the whole and open the java project again with VS code. Then after workspace creation has done, import the jar files.
@aayushsolanki2690
@aayushsolanki2690 4 жыл бұрын
showing error class not found java.lang.ClassNotFoundException: com.mysql.jdbc.Driver please help
@harshith_takkala
@harshith_takkala 4 жыл бұрын
May be: 1. You haven't imported the correct jar file (jdbc driver from MySQL Installation) 2. Try to clear the workspace cache in VS Code. (don't know how but sometimes VS Code recommends me to do by a notification) 3. Restart the whole procedure... 4. Replace the statement "Class.forName("com.mysql.jdbc.Driver");" to "Class.forName("com.mysql.cj.jdbc.Driver");" (suggestion given by VS Code terminal) Hope it helps.
@harshith_takkala
@harshith_takkala 4 жыл бұрын
Or the main reason can be, you may not set the path for MySQL bin folder in either system variables or user variables..
@vedgurnule
@vedgurnule 2 жыл бұрын
I cannot find the Connector J folder even after installing twice
@harshith_takkala
@harshith_takkala 2 жыл бұрын
Not able to find J connector in MySQL installation ? I think you havent checked it while installation Just edit the installation using "installer-community"
@vedgurnule
@vedgurnule 2 жыл бұрын
@@harshith_takkala I found it but it is in Program Files (x86) Folder Will that cause an issue?
@harshith_takkala
@harshith_takkala 2 жыл бұрын
@@vedgurnule no, it is right, MySQL stores some of its files there also
@vedgurnule
@vedgurnule 2 жыл бұрын
@@harshith_takkala ok I thank you for the prompt reply
@jinside8279
@jinside8279 3 жыл бұрын
how to run this prject on browser
@harshith_takkala
@harshith_takkala 3 жыл бұрын
I think you are trying to combine the JSP, servlets and Mysql. If I am right, then i have a playlist. Please check it.
@parthjaiswal6151
@parthjaiswal6151 3 жыл бұрын
nice learning from a fellow vitian
@harshith_takkala
@harshith_takkala 3 жыл бұрын
Hii🙂
@nagraj8949
@nagraj8949 3 жыл бұрын
Says unknown database. How to resolve this error
@harshith_takkala
@harshith_takkala 3 жыл бұрын
1. May be you dont have the database with the given name 2. May be do you have database with that name in the port running (3600)
@ИнкарЖолдыбай-ч9ж
@ИнкарЖолдыбай-ч9ж 3 ай бұрын
thank you so much
@padhaiparcharcha
@padhaiparcharcha 3 жыл бұрын
Can I download separate jdbc driver file?
@harshith_takkala
@harshith_takkala 3 жыл бұрын
You can download it if you are already installed with basic MySQL installation. You can run "MySQL installer- Community" and add Connector/J through which dependency will be downloaded into your MySQL installation. OR Visit this: dev.mysql.com/downloads/connector/j/ Choose archives, choose "platform independent" as the Operating system and there you get a ZIP file (and also TAR available). Unzip and you get the jar file.
@padhaiparcharcha
@padhaiparcharcha 3 жыл бұрын
@@harshith_takkala in which folder I should add this jar file?
@harshith_takkala
@harshith_takkala 3 жыл бұрын
@@padhaiparcharcha just download the zip file, extract it and remember the location and then follow the same as I did from 07:27 ✌
@padhaiparcharcha
@padhaiparcharcha 3 жыл бұрын
@@harshith_takkala how to enable options of refrenced library?
@harshith_takkala
@harshith_takkala 3 жыл бұрын
@@padhaiparcharcha in the "Java projects" named explored, you will find it. You have to open the VS code again from project root directory to see that.
@nikhiljoshi9440
@nikhiljoshi9440 3 жыл бұрын
Showing error: Failed to launch debuggee in terminal. And asking to open launch.json
@harshith_takkala
@harshith_takkala 3 жыл бұрын
Hey, my debugging is going fine, I have tried. This is how the launch.json must look similarly: { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "java", "name": "Launch Current File", "request": "launch", "mainClass": "${file}" }, { "type": "java", "name": "Launch App", "request": "launch", "mainClass": "App", "projectName": "database_495139a9" } ] } This is for the jdbc code in App.java, where project name is "database". The "mainClass" attribute is created after you first run or debug the project. Hope it helps
@nikhiljoshi9440
@nikhiljoshi9440 3 жыл бұрын
@@harshith_takkala I turned off Compatibility mode and now it's working. But when I am connecting mysql database to VSCode (not for jdbc) it's showing that couldn't find any database driver. Oracle MySql is already installed in my pc and I want to connect it to VSCode. I have also installed MySql Management tool in VSCode. The problem is that VSCode couldn't find mysql driver. I have tried my best and checked class path and online solution (Google and KZbin) but all in vain. www.dropbox.com/s/8h713dirqax0f1v/2021-03-01-16-32-50.mp4?dl=0
@harshith_takkala
@harshith_takkala 3 жыл бұрын
@@nikhiljoshi9440 oh! I dont know that there is a concept of just connecting vs code with mysql. I will check into it. Thanks for the information 🙂
@nikhiljoshi9440
@nikhiljoshi9440 3 жыл бұрын
@@harshith_takkala ok check the video I have mentioned in above comment.
@harshith_takkala
@harshith_takkala 3 жыл бұрын
Yeah I got the video link in the notifications but not in the youtube comments.. Why like that I have seen your screen recording, and i will let u know soon. Edit: oh I got it thanks, I got it.🙂🙂 I have seen it and understood. But for this video I havent used any vs code extension specifically for mysql I will see that for sure, thanks for the video
@deepakchauhn1512
@deepakchauhn1512 2 жыл бұрын
i want that notepad file can you share
@harshith_takkala
@harshith_takkala 2 жыл бұрын
That's just for the reference buddy. It's just a boiler plate code for any JDBC programs in initial stages. You can find the same in online JDBS tutorials!
@yugansh4356
@yugansh4356 3 жыл бұрын
Thank you so much you deserve much subscriber
@CelineCardoso-n2p
@CelineCardoso-n2p 21 күн бұрын
can you paste the code you used in the comments?
@FFODP
@FFODP Ай бұрын
You helped me ... thank man
@supraja719
@supraja719 3 жыл бұрын
Thank you so much for the vedio it is useful, and may i know how we can create a database of our own and also table
@harshith_takkala
@harshith_takkala 3 жыл бұрын
Yes we can, I think you are ready with the MySQL. You can do that either by using command line client or Workbench.
@supraja719
@supraja719 3 жыл бұрын
@@harshith_takkalayeah i got it Command : create database; 😅
@princechoudhary4335
@princechoudhary4335 2 жыл бұрын
Are you from VIT?
@harshith_takkala
@harshith_takkala 2 жыл бұрын
Yeah, you too ?
@princechoudhary4335
@princechoudhary4335 2 жыл бұрын
@@harshith_takkala yeah Your lab cat and labfat databases Lol😂
@harshith_takkala
@harshith_takkala 2 жыл бұрын
@@princechoudhary4335 yeah bro 😅😅
@LightWalk3r
@LightWalk3r 2 жыл бұрын
Thank you, this was super helpful
@SpringBoot3.0
@SpringBoot3.0 3 жыл бұрын
Thanks bro Awesome Tutorial!
@AmanKumar-wu3ej
@AmanKumar-wu3ej Жыл бұрын
Thnaku bro you are life saver
@carladomingomiquel4744
@carladomingomiquel4744 7 ай бұрын
you are the best!!!! thank you so much!
@FERRUM-ix5yk
@FERRUM-ix5yk 2 ай бұрын
What caste are you from, dude?
@harshith_takkala
@harshith_takkala 2 ай бұрын
@@FERRUM-ix5yk why buddy ?
@OsomWay
@OsomWay 3 жыл бұрын
You are a monster. Thank you bro!
@harshith_takkala
@harshith_takkala 3 жыл бұрын
😂
@yunusshaikh7478
@yunusshaikh7478 3 жыл бұрын
thank you so much . It really helped me
@anmolverma2911
@anmolverma2911 2 жыл бұрын
Thanks 🔥🔥🔥🚀👍
@krishraj7808
@krishraj7808 5 ай бұрын
Thanks a lot man 🤝. I was struggling in running this program for 4-5 hours. Don't know where to put the .jar file and getting an error every time. (❁´◡`❁)
@ahmadshodikin262
@ahmadshodikin262 2 жыл бұрын
thanks, it really help :)
@drxninja745
@drxninja745 2 жыл бұрын
video was helpful, but lol u dont have to hide ur sql password, cuz no one can misuse it nor access it
@harshith_takkala
@harshith_takkala 2 жыл бұрын
ha locally its not possible, but if i deploy this project, it can be misused.
@toriljain2711
@toriljain2711 Жыл бұрын
thank you bhaiya
@shivamseth2851
@shivamseth2851 3 жыл бұрын
dhanyawad :-)
@tejasbele1456
@tejasbele1456 4 жыл бұрын
Thank you so much...
@vidyatrimbake480
@vidyatrimbake480 2 жыл бұрын
Great!!🌻
@nitigyajoshi4658
@nitigyajoshi4658 3 жыл бұрын
thanks a lot sir
@hilmanaziz
@hilmanaziz 3 жыл бұрын
another great video
@akramchaudhary4403
@akramchaudhary4403 3 жыл бұрын
Kya yr thoda Tezz bol leta bhai ghnta kuch sunai nhi de rha
@harshith_takkala
@harshith_takkala 3 жыл бұрын
Ha bhai sure, Baat ye hai ki mere pass mic ka set nahi hei
@t.a.f.6736
@t.a.f.6736 3 жыл бұрын
Thank you!
@nishankpriydarshi5200
@nishankpriydarshi5200 3 жыл бұрын
record to dhang se kar lete bhai
@harshith_takkala
@harshith_takkala 3 жыл бұрын
Ha bhai. Sorry for that. Ab se videos sahi honge
@nishankpriydarshi5200
@nishankpriydarshi5200 3 жыл бұрын
@@harshith_takkala Nice 😀
@AryanKumar-vk1ex
@AryanKumar-vk1ex 5 ай бұрын
in MYSQL connector file is not showing
@harshith_takkala
@harshith_takkala 5 ай бұрын
@@AryanKumar-vk1ex if not there, then from mysql installer you have to install it. I guess you havent checked the checkbox in first time installation.
@raheenbagwan2240
@raheenbagwan2240 3 жыл бұрын
Thank you so much
Java Database Connectivity | JDBC
20:34
Telusko
Рет қаралды 364 М.
Война Семей - ВСЕ СЕРИИ, 1 сезон (серии 1-20)
7:40:31
Семейные Сериалы
Рет қаралды 1,6 МЛН
Andro, ELMAN, TONI, MONA - Зари (Official Music Video)
2:50
RAAVA MUSIC
Рет қаралды 2 МЛН
Sigma girl VS Sigma Error girl 2  #shorts #sigma
0:27
Jin and Hattie
Рет қаралды 124 МЛН
Debugging a Java Web App using Tomcat & VS Code
9:12
Brandon Donnelson
Рет қаралды 48 М.
Run MySQL Database Queries From VS Code
6:34
Tech VideoStack
Рет қаралды 119 М.
How to Use VS Code to Run SQL on a Database
15:06
Database Star
Рет қаралды 309 М.
How TO Connect To MYSQL SERVER & RUN SQL Queries Using VSCode
11:25
How I'd learn ML in 2025 (if I could start over)
16:24
Boris Meinardus
Рет қаралды 26 М.
Война Семей - ВСЕ СЕРИИ, 1 сезон (серии 1-20)
7:40:31
Семейные Сериалы
Рет қаралды 1,6 МЛН