java connect to mysql
import java.sql.*;
class MySqlConn{
public static void main(String args[]){
try{
Class.forName("com.mysql.cj.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://
localhost:3306/databasename","username","password");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from emp");
con.close();
}catch(Exception ex){
System.out.println(ex);
}
}
}
Also in Java:
- string replace java
- even or odd in java
- reading string after double in java
- java convert String to int
- java string regexp replace
- how to create a draw Rectangle in java
- ARE THERE POINTER IN JAVA
- waht does&& mean in java
- java hahmap
- hide element selenium
- android get last crash adb
- java processbuilder example
- java constructor genertic
- how to make int array java android
- create an empty array in java
- how to select a random element from an array in java
- how to use the this keyword in java
- java double format
- The shrinker may have failed to optimize the Java bytecode. To disable the shrinker, pass the `--no-shrink` flag to this command.
- declare array java inline
- take a value from keyboard java
- Caused by: java.lang.NumberFormatException: Invalid int: ""
- java define a generic class that produces
- change button color java swing