eclipse에 connector-j연결

-·2020년 10월 31일
0
  1. Connector/J 를 다운받기

https://downloads.mariadb.org/connector-java/

  1. eclipse설정

Properties > Java Build Path > Libraries탭의 Add External JARs... > 다운받은 파일 선택

Deployment Assembly > Add > Java Build Path Entries > connector j 선택

	String sql = "";
	String url = "jdbc:mariadb://localhost:3306/db이름";
	String uid = "myId";
	String upw = "myPassword"
	Connection conn = null;
	
	try {
		Class.forName("org.mariadb.jdbc.Driver");
		conn = DriverManager.getConnection(url, uid, upw);
		System.out.println("db연결 성공!");
	}catch(ClassNotFoundException e){
		e.printStackTrace();
	}catch(SQLException e){
		e.printStackTrace();
	}

간단하게 확인

"db연결 성공!" 출력하면 성공적으로 연결된거

profile
거북이는 오늘도 걷는다

0개의 댓글