Skip to main content

Posts

Showing posts from March, 2022

JAVA MySQL database connectivity

 JAVA MySQL database connectivity  sample program Below is the the code for Java MySQL database create connection and fetch the data from the database. You need to download Jar or add dependency for java MySQL connector. Please refer following link for the same: https://mvnrepository.com/artifact/mysql/mysql-connector-java Below is the sample code: package test_mysql_connection_demo; import java.awt.BorderLayout; import java.sql.*; import java.util.ArrayList; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; public class Test_mysql_connection_demo { public static void main(String args[]){     Test_mysql tm = new Test_mysql(); tm.conData(); boolean b = tm.exSQL("select * from student"); System.out.println(b); }   } class Test_mysql { public Connection con; void conData() {     try { ...