database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
ㆍPostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
PostgreSQL Q&A 3022 게시물 읽기
No. 3022
jdbc connection 문제
작성자
김명수
작성일
2001-06-26 17:49
조회수
2,594

환경은 터보리눅스이고, postgres는 리눅스 setting 때 옵션으로 깔았습니다.

jdbc드라이버를 compile할려고 하니 'src/interfaces/jdbc'디렉토리가 없더군요.

그래서 여기 자료실에 가서 'postgressql.jar'을 다운받아

/var/lib/pqsql/jdbc디레토리를 만들고 .bash_profile에 classpath를 잡았습니다.

'CLASSPATH=/var/lib/pgsql/jdbc/postgresql.jar:.'

 

소스코드인 postJdbcTest.jsp입니다. 좀 봐주십시요.드라이버 로드는 되는데

connection이 안 맺어지더라구요.

System.out.println으로 프린트 해보니

System.out.println("1");은 프린트 되는데,

System.out.println("2");는 안되더라구요...

 

<%@ page contentType="text/html; charset=EUC-KR" %>

<%@ page language="java" import="java.util.*, java.sql.*, java.io.*" %>

 

<html>

<head>

<title>:::::포스트그레스 Connection Test:::::</title>

<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">

</head>

<body>

<br>

<%

Connection conn = null;

 

try{

// Class.forName("org.postgresql.Driver");

DriverManager.registerDriver(new org.postgresql.Driver());

System.out.println("1");

 

conn = DriverManager.getConnection ("jdbc:postgresql:template1", "kms","kms");

 

 

// conn = DriverManager.getConnection("jdbc");

System.out.println("2");

 

if(conn != null){

out.println("PostgreSql DB Connection Success!!!");

}

 

if(conn == null){

out.println("PostgreSql DB Connection Failed!!!");

}

 

conn.close();

 

// }catch(ClassNotFoundException e) {

// conn.close();

// out.println(e.getMessage());

}catch(SQLException ex){

conn.close();

out.println(ex.getMessage());

}catch(Exception e){

System.out.println("1"+e.getMessage());

}finally{

if(conn != null){

try{

conn.close();

}catch(Exception ex) {}

}

}

%>

 

</body>

</html>

[Top]
No.
제목
작성자
작성일
조회
3026libpq++ connect 질문에 대한 추가 질문 입니다.
이성한
2001-06-25
2246
3027┕>Re: libpq++ connect 질문에 대한 추가 질문 입니다.
정재익
2001-06-25 19:02:49
2370
3024처음으로 질문입니다. - libpq++ connect 질문 입니다.
이성한
2001-06-25
2387
3025┕>Re: 처음으로 질문입니다. - libpq++ connect 질문 입니다.
정재익
2001-06-25 17:37:06
2647
3023데몬 자동으로 띄우는 방법...
박경희
2001-06-25
2385
3031┕>Re: 데몬 자동으로 띄우는 방법...
김남수
2001-06-25 21:18:29
2805
3022jdbc connection 문제
김명수
2001-06-26
2594
3039┕>Re: jdbc connection 문제
김일형
2001-06-26 13:09:12
2832
3040 ┕>Re: Re: jdbc connection 문제
김명수
2001-06-26 17:48:51
2741
3042  ┕>Re: jdbc connection 문제
김일형
2001-06-26 22:10:30
2873
3021postgres를 시작하면 다음과 같은 에러메세지가....
여준성
2001-06-25
2638
3028┕>Re: postgres를 시작하면 다음과 같은 에러메세지가....
정재익
2001-06-25 19:04:39
2640
3035 ┕>Re: Re: 이번에는 이런 메세지가.....
여준성
2001-06-26 10:56:51
3012
3019윈도우용 postgresql 사용법에 관하여
이상학
2001-06-25
3891
3018PHP를 이용한 large object의 import
윤신영
2001-06-23
3337
3068┕>Re: PHP를 이용한 large object의 import
윤신영
2001-07-04 11:34:17
2912
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.020초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다