이거 하나때문에 어제 하루 날렸는데 미치겠습니다 도와주세요 형님들
<%!
Connection conn; // 디비 연결 변수
PreparedStatement pstmt; // 쿼리 핸들 변수
String sql; // 쿼리문
ResultSet rs; // 결과를 받아올 변수
public void init() //Call Back메소드, 드라이버 로딩
{
try {Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");} // 드라이버 로딩
catch (ClassNotFoundException e) {e.printStackTrace(); } // 드라이버 클래스가 없는 예외 발생시 오류 출력
}
public void setConnection() // 디비 입출력전 연결 메소드
{
try{conn = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;DatabaseName=dbMember", "Member", "1234");} // 디비 연결
catch (SQLException e) {e.printStackTrace();} // 예외상황발생시 오류 출력
}
%>
<%
//1. 데이터 받아오기
request.setCharacterEncoding("euc-kr"); // 넘어오는값을 한글사용가능
String id = request.getParameter("id"); // 넘어온 아이디 값 저장
String pwd = request.getParameter("pwd"); // 넘어온 패스워드 값 저장
// 2. db 연결
this.setConnection(); // db 연결 메소스 호출
sql = "select * from member where id='" + id + "' and pwd='" + pwd + "'"; //쿼리생성
System.out.println(sql);
try // 오류시 catch 부분의 에러메시지 출력
{
pstmt = conn.prepareStatement(sql); // 디비 연결
rs=pstmt.executeQuery(); // 쿼리 전송
}
catch (SQLException e){e.printStackTrace();} // 예외상황 발생시 오류 출력
%>
아니이게뭐야
pstmt = conn.prepareStatement(sql); 여기서 계속 에러가 나네요 ㅜㅜ
Connection 객체를 못받았나보지
conn에 계속 널값이 들어가는거같은데 이유를 모르겠네요
그럼 그게 연결 실패지 뭐야..
음..
http://msdn.microsoft.com/en-us/library/ms378428.aspx
이거에 맞춰 쓴게 맞나
망할 odbc 잘못 설정되어있었네요
해결됫습니다 감사합니다
ㅋㅋㅋ odbc
답은 거것이였다.