like, share , subscribe
----------------------- Mysql code:
create database sonoo;
use sonoo;
create table emp(id int(10),name varchar(40),age int(3));
----------------------- Java code:
import java.sql.*;
class MysqlCon{
public static void main(String args[]){
try{
Class.forName("com.mysql.jdbc.Driver");
String jdbcUrl = "jdbc:mysql://localhost:3306/sonoo";
Connection cnx = DriverManager.getConnection(jdbcUrl, "root", "root");
//here sonoo is database name, root is username and password
Statement st = cnx.createStatement();
String sql = String.format("insert into emp values(%d, '%s', %d)",1, "hello", 15);
System.out.println(sql);
int n = st.executeUpdate(sql);
System.out.println("number of instrucations: " + n);
cnx.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
----------------------- Mysql.jar file:
https://static.javatpoint.com/src/jdb... (remane it)
----------------------- windows cmd:
java -cp mysqlconnector.jar Test.java
Follow me on :
Electronics Channel : / @dark_ink_electronics
Music Channel : / @kzbeats_0
twitter : / darkpinkp
soundcloud : / user-163169075
#DarkPink_Electronics #electronics #programming
On this page of the site you can watch the video online java.lang.ClassNotFoundException: com.mysql.jdbc.Driver with a duration of hours minute second in good quality, which was uploaded by the user Dark ink electronics 19 January 2024, share the link with friends and acquaintances, this video has already been watched 943 times on youtube and it was liked by 4 viewers. Enjoy your viewing!