'Programming'에 해당되는 글 184건
- 2014.01.24 grails 한글화 문서 및 설치
- 2013.12.06 브라우저는 어떻게 동작하는가?
- 2013.11.25 windows cmd : tail -f filename
- 2013.11.25 생활코딩 정리
- 2013.11.25 html5 한글화
- 2013.11.18 [정규식] 정규표현식 시각화
- 2013.11.13 [Cent OS] oracle원격설치
- 2013.11.08 [redhat] redhat 9에서 yum 설치하기
- 2013.11.08 [log4jdbc]SQL query log
- 2013.11.05 [IBSheet] 도움말 파일
windows cmd : tail -f filename
window 에서도 tail...
http://www.windows-commandline.com/tail-command-for-windows/
[정규식] 정규표현식 시각화
[Cent OS] oracle원격설치
A : 원격지 server (Cent OS)
B : 내 PC client (Cent OS)
A에는 오라클을 설치할 준비가 다 되어있다는 가정하에(oracle 계정생성 및 설치파일 준비완료)
B 에는 X-Window가 설치가 되어있어야 한다.
안되어있으면 yum 으로 설치
yum groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"
설치 후
1. xhost 에 원격지 서버인 A 추가
xhost + (A IP)
2. ssh로 A 접근
ssh -X oracle@A IP
3. cd database(오라클 설치 파일이 들어있는 폴더)
4. ./runInstaller
그럼 내 PC에 원격지 PC의 오라클 인스톨러 화면이 뜬다.
끝.
[redhat] redhat 9에서 yum 설치하기
yum 치면
-bash: yum: command not found
yum 설치 진행
1. yum 다운 받는다
2. 압축을 푼다.
tar -xvf 파일이름
3. 압축된 폴더로 이동하여 아래와 같이 입력한다.
make
make install
4. 설치를 확인한다.
[출처] http://yagi815.tistory.com/337
==> 간단한데 설치가 안된다.
## Redhat9에서 Yum설치하기
http://blog.naver.com/PostView.nhn?blogId=hellruin0&logNo=120119968219
[log4jdbc]SQL query log
1. table 생성
create table testuser(
id varchar2(100),
pass varchar2(100)
);
insert into testuser values('a', '1234');
insert into testuser values('b', '3456');
commit;
2. 사용되는 라이브러리들.
log4j.jar
log4jdbc3-1.2.jar
ojdbc6.jar
slf4j-api-1.5.1.jar
slf4j-log4j12-1.5.1.jar
3. SqlLogMain.java
import java.sql.*;
public class SqlLogMain {
private static final String DB_DRIVER = "net.sf.log4jdbc.DriverSpy";
private static final String DB_CONNECTION = "jdbc:log4jdbc:oracle:thin:@localhost:1521:orcl";
// private static final String DB_DRIVER = "oracle.jdbc.driver.OracleDriver";
/
/ private static final String DB_CONNECTION = "jdbc:oracle:thin:@localhost:1521:orcl";
private static final String DB_USER = "id";
private static final String DB_PASSWORD = "pass";
public static void main(String[] args){
try {
selectRecordsFromDbUserTable();
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
private static void selectRecordsFromDbUserTable() throws SQLException {
Connection dbConnection = null;
PreparedStatement preparedStatement = null;
StringBuffer strSQL = new StringBuffer();
strSQL.append("select * from testuser where id= ? ");
try {
dbConnection = getDBConnection();
preparedStatement = dbConnection.prepareStatement(strSQL.toString());
preparedStatement.setString(1, "a");
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
String pass = rs.getString("pass");
System.out.println("pass : " + pass);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (preparedStatement != null) {
preparedStatement.close();
}
if (dbConnection != null) {
dbConnection.close();
}
}
}
private static Connection getDBConnection() {
Connection dbConnection = null;
try {
Class.forName(DB_DRIVER);
} catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}
try {
dbConnection = DriverManager.getConnection(DB_CONNECTION, DB_USER,
DB_PASSWORD);
return dbConnection;
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return dbConnection;
}
}
4. properties/log4j.properties
log4j.rootLogger=INFO, console
# Console log
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p %l - %m%n
log4j.logger.jdbc.sqlonly=console
5. properties 폴더를 프로젝트에 소스 폴더로 포함시킨다.
------------결과-------------
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.connectionOpened(Slf4jSpyLogDelegator.java:537) - 1. Connection opened
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.methodReturned(Slf4jSpyLogDelegator.java:162) - 1. Connection.new Connection returned
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.methodReturned(Slf4jSpyLogDelegator.java:162) - 1. PreparedStatement.new PreparedStatement returned
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.methodReturned(Slf4jSpyLogDelegator.java:162) - 1. Connection.prepareStatement(select * from testuser where id= ? ) returned net.sf.log4jdbc.PreparedStatementSpy@1dc7e0e8
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.methodReturned(Slf4jSpyLogDelegator.java:162) - 1. PreparedStatement.setString(1, "a") returned
DEBUG net.sf.log4jdbc.Slf4jSpyLogDelegator.sqlOccured(Slf4jSpyLogDelegator.java:221) - SqlLogMain.selectRecordsFromDbUserTable(SqlLogMain.java:32)
1. select * from testuser where id= 'a'
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.sqlTimingOccured(Slf4jSpyLogDelegator.java:370) - select * from testuser where id= 'a'
{executed in 13 msec}
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.methodReturned(Slf4jSpyLogDelegator.java:162) - 1. ResultSet.new ResultSet returned
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.methodReturned(Slf4jSpyLogDelegator.java:162) - 1. PreparedStatement.executeQuery() returned net.sf.log4jdbc.ResultSetSpy@5f122d62
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.methodReturned(Slf4jSpyLogDelegator.java:162) - 1. ResultSet.next() returned true
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.methodReturned(Slf4jSpyLogDelegator.java:162) - 1. ResultSet.getString(pass) returned 1234
pass : 1234
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.methodReturned(Slf4jSpyLogDelegator.java:162) - 1. ResultSet.next() returned false
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.methodReturned(Slf4jSpyLogDelegator.java:162) - 1. PreparedStatement.close() returned
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.connectionClosed(Slf4jSpyLogDelegator.java:556) - 1. Connection closed
INFO net.sf.log4jdbc.Slf4jSpyLogDelegator.methodReturned(Slf4jSpyLogDelegator.java:162) - 1. Connection.close() returned