아래 손가락을 눌러주세요. 

 




 

 

JDBCTest.txt

 


DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "admin");
-> ("mysql의 3306포트 데이터베이스 test에 연결", "mysql계정 아이디", "mysql계정 비밀번호")

import java.sql.*;

// jdbc 연동 테스트
public class DriverTest {
	

	public static void main(String args[]) {

		Connection conn;

		try {
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			conn = DriverManager.getConnection(
					"jdbc:mysql://localhost:3306/test", "root", "admin");
			System.out.println("Success!");
		} catch (SQLException ex) {
			System.out.println("SQLException:" + ex);
		} catch (Exception e) {
			System.out.println("Exception:" + e);
		}
	}
}


posted by 쪼재