Answers for "mysql url"

SQL
12

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);
        }  
    }
}
Posted by: Guest on May-22-2020
0

mysql url

<!-- MySQL dataSource config -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.cj.jdbc.Driver" /><!-- mysql 8 -->
    <property name="url" value="jdbc:mysql://localhost:3306/mydb?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8" />
    <property name="username" value="matt" />
    <property name="password" value="12345" />
</bean>
Posted by: Guest on February-17-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language