eclipse JDBC 연동 오류

박창현·2022년 10월 24일
0
package com.postgresqltutorial;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;




public class App {
	
	public static void main(String[] args) {
		App app = new App();
		app.connection();
	}

	private final String url = "jdbc:postgresql://localhost:5432/postgres";
	private final String user = "postgres";
	private final String password = "sql041279!";
	

	public Connection connection () {
		Connection conn = null;
		try {
			conn = DriverManager.getConnection(url, user, password);
			System.out.println("connected server successfully");
			
		} catch (SQLException e) {
			System.out.println(e.getMessage());
		}
		return conn;
	}

}

위와 같은 코드작성시에
no suitable driver found for jdbc
라는 에러가 발생할 수 있다.

경로설정도 다 잘했다고 생각한다면
마지막으로 설정 - java - installed JREs 에서 작동하는 자바 버전의 설정에 들어가 jdbc 파일을 직접 import 해준다.

profile
개강했기에 가끔씩 업로드.

0개의 댓글