728x90

 

C:\sqlite\sqlite3.exe 를 관리자 권한으로 실행하면 아래와 같이 Command 창을 확인할 수 있다.

 

도움말을 보고 싶다면 .help 명령어를 사용한다.

sqlite> .help 

 

신규 설치하였으니 현재 만들어진 데이터베이스가 없다.

 

.open 명령어를 사용하여 데이터베이스를 접근해야하지만 없으니 내가 생성할 데이터베이스명을 입력하면

자동생성되고 접근이 가능하다.

나는 sealove3904.db 를 생성하고 접근해보겠다. 

 

sqlite> .open sealove3904.db

 

위 그림을 보면 sealove3904.db 파일이 생성된 걸 확인 할 수 있다.

 

내가 현재 연결된 데이터베이스를 확인할려면 

sqlite> .database

 

내가 연결된 데이터베이스에 테이블 목록을 확인하려면

sqlite> .tables

 

쉽죠..

 

테이블 생성(CREATE)

CREATE TABLE NEW_TBL (
	 SEQ INTEGER PRIMARY KEY
	,USER_NAME TEXT NOT NULL
	,USER_ID TEXT NOT NULL UNIQUE
	,EMAIL TEXT NOT NULL UNIQUE
);

생성된 데이블에 데이터 입력(INSERT).

INSERT INTO NEW_TBL (SEQ, USER_NAME, USER_ID, EMAIL)VALUES(1, '홍길동', 'hong', 'hong@gmail.com');
INSERT INTO NEW_TBL (SEQ, USER_NAME, USER_ID, EMAIL)VALUES(2, '김길동', 'kim', 'kim@gmail.com');

테이블 데이터 조회(SELECT)

SELECT * FROM NEW_TBL;

 

최종 결과를 확인해볼께요..

 

SQLite 종료는 

sqlite> .exit 

 

이상입니다. 

 

생각보다 너무 쉽네요..

 

 

728x90
반응형

'IT 인터넷 > SQLite' 카테고리의 다른 글

SQLite 다운로드 및 설치하기  (0) 2023.10.19
728x90

넥사크로 N 에서 SQLite 접속 후 조회할 일이 있어 사용하게 되었다.

 

다운로드는 아래 링크 참고..

 

SQLite Download Page

 

SQLite Download Page

Templates (1) and (2) are used for source-code products. Template (1) is used for generic source-code products and templates (2) is used for source-code products that are generally only useful on unix-like platforms. Template (3) is used for precompiled bi

www.sqlite.org

 

 

1. 아래 이미지와 같이   Precompiled Binaries for Windows > sqlite-tools-win32.....zip 파일을 다운로드한다.

 

2. 다운로드한 파일을 아래 경로와 같이 압축을 푼다.

 

3. sqlite3.exe 관리자 권한으로 실행하면 아래와 같이 확인이 가능하다.

 

 

간단하네요..

 

다음엔

데이터베이스 생성(CREATE), 테이블 생성(CREATE), 데이터 입력(INSERT), 데이터 조회(SELECT) 까지 알아볼께요.

728x90
반응형
728x90

현재 진행중인 프로젝트에서 공통프로젝트가 있고 각 업무시스템이 별도로 있는 상태이다.
그림으로 그려보면 아래와 같다.

개발환경 구성시에는 아래 그림과 같이 하면된다.

((STEP1)) Java Build Path > Projects > Add... 버튼을 통해 [공통프로젝트]를 추가 해준다.

((STEP2)) Deployment Assembly > Add... 버튼을 통해 [공통프로젝트]를 추가해준다.

Prject References 에 [공통프로젝트] 에 체크가 되어 있는지 확인해본다. 안되어 있음 체크하도록...

끝~

너무 쉽다...

 

하지만 같이 개발하는 사람이 많다면 오류가 날 수 있는 경우가 있는데..

나와 같은 경우엔 누군가 수정한 소스를 내려받았는데 Method를 찾지 못해 오류가 발생되어 봤더니 동일한 Class 파일이 다른 jar 파일에 있어 오류가 발생된 경우였다.

소스를 참조해야하는 순서를 변경하는 옵션이 이클립스에 있어 변경하여 처리하였다.

 

이상 끝~

 

728x90
반응형

'IT 인터넷 > Java' 카테고리의 다른 글

String.format() 사용방법  (0) 2022.10.12
728x90

1. Sections of code should not be commented out.

2. This block of commented-out lines of code should be removed.

[오류내용]

// CASE 1
/* resultMap.put("RESULT_CD", output.get("result_cd")); */

// CASE 2
/*
	for(int i=0; i<10; i++){
    	...~~~~~~
        ...~~~~~~~~~
    }
 */

// CASE 3
/*
	resultMap.put(RESULT_MSG, output.get("result_msg"));
	// 정상적으로 API가 성공한 경우
	if(output.get("result_cd").equals(RESULT_CODE_200)) {
		resultMap.put("STATUS", output.get("status"));
	} 
 */

[해결방법]

프로그래밍 주석은 삭제처리하면 된다.

이유는 납득이 안간다. ㅋㅋ

쓰레기 코드가 있어서 좋을건 없지만 지우면 된다.

 

728x90
반응형
728x90

1. Source files should not have any duplicated blocks.

2. This block of commented-out lines of code should be removed.

[오류내용]

// CASE 1
/* resultMap.put("RESULT_CD", output.get("result_cd")); */

// CASE 2
/*
	for(int i=0; i<10; i++){
    	...~~~~~~
        ...~~~~~~~~~
    }
 */

// CASE 3
/*
	resultMap.put(RESULT_MSG, output.get("result_msg"));
	// 정상적으로 API가 성공한 경우
	if(output.get("result_cd").equals(RESULT_CODE_200)) {
		resultMap.put("STATUS", output.get("status"));
	} 
 */

[해결방법]

프로그래밍 주석은 삭제처리하면 된다.

이유는 납득이 안간다. ㅋㅋ

쓰레기 코드가 있어서 좋을건 없지만 지우면 된다.

 

728x90
반응형
728x90

1. Modifiers should be declared in the correct order.

2. Reorder the modifiers to comply with the Java Language Specification.

[오류내용]

// CASE 1
private final static String DS_SEARCH = "dsSearch";

// CASE 2
final static String DS_SEARCH = "dsSearch";

// CASE 3
final String DS_SEARCH = "dsSearch";

[해결방법]

자바에서는 표준문법을 따르길 원하며 위와 같이 썼을 경우 문제가 발생되지 않은 경우도 있지만 프로그래밍의 가독성을 위해서라도 아래와 같은 순서대로 선언해서 쓰기를 권장한다.

  1. Annotations
  2. public
  3. protected
  4. private
  5. abstract
  6. static
  7. final
  8. transient
  9. volatile
  10. synchronized
  11. native
  12. strictfp
// CASE 1
private static final String DS_SEARCH = "dsSearch";

// CASE 2
public String DS_SEARCH = "dsSearch";

// CASE 3
private String DS_SEARCH = "dsSearch";

 

아래 링크도 참고하시면 좋을듯..

https://sealove3904.tistory.com/m/30

 

[소나큐브] Field names should comply with a naming convention

[오류내용] 아래 오류 5가지 케이스에 모두 해당하는 동일한 해결방안으로 간다. 1. Rename this field "GET_TOKEN_URL" to match the regular expression '^[a-z][a-zA-Z0-9]*$'. 2. Make this final field static too. 3. Field names shoul

sealove3904.tistory.com

 

728x90
반응형
728x90

[오류내용]

Immediately return this expression instead of assigning it to the temporary variable "result".
Local variables should not be declared and then immediately returned or thrown

[해결방법]

return xxxxxAppService.selectList("XXXX.selectHolidayList", paramDto);

 

728x90
반응형
728x90

[오류내용]

Null pointers should not be dereferenced
A "NullPointerException" could be thrown; "map" is nullable here.

[해결방법]

		HashMap<String, Object> map = new HashMap<>(); 
		
		if(dsList.getRowCount() > 0) {    //공지사항 수신팀 등록
			map = (HashMap<String, Object>) dsList.getRowToMap(0);
			resultCount += commonAppService.insert("AFSZ2030F00.savePwiImtmL",map);
		}
		
		String pwiImtrNo = StringUtil.nvl(map.get("PWI_IMTR_NO"), "");  //공지사항 번호

 

프로젝트마다 Object 나 String 변수 Null 체크하는 유틸을 사용하면 된다.

물론 오픈소스 사용도 가능하다.

728x90
반응형
728x90

[오류내용]

Remove this unused import 'javax.transaction.Transactional'.
Unnecessary imports should be removed.

[해결방법]

해당 클래스에서 사용하지 않은 import 이므로 라인 삭제로 해결하면 된다.

 

 

 

728x90
반응형

+ Recent posts