자바 네트워크 : UDP

import java.io.IOException;

import java.net.DatagramPacket;

import java.net.DatagramSocket;

import java.net.InetAddress;

import java.net.SocketException;

import java.text.SimpleDateFormat;

import java.util.Date;


public class UDPTimeServer {

private DatagramSocket server;

private DatagramPacket rPacket, sPacket;

private UDPTimeServer(){

try{

this.server = new DatagramSocket(9999);

System.out.println("Server is ready...");

}catch(SocketException ex){

ex.printStackTrace();

}catch(Exception ex){

ex.printStackTrace();

}

}

private void service(){

String pattern = "지금은 yyyy-MM-dd aa HH:mm:ss 입니다.";

SimpleDateFormat sdf = new SimpleDateFormat(pattern);

try{

while(true){

byte [] buffer = new byte[10];

this.rPacket = new DatagramPacket(buffer, buffer.length);  //받는 패킷

this.server.receive(rPacket);   //수신

InetAddress ia = rPacket.getAddress();  //client 주소

int port = rPacket.getPort();   //client port number

String msg = sdf.format(new Date());

this.sPacket = new DatagramPacket(msg.getBytes(), msg.getBytes().length, ia, port);

this.server.send(sPacket);   //발송

}

}catch(IOException ex){

ex.printStackTrace();

}

}

public static void main(String[] args) {

new UDPTimeServer().service();

}

}





import java.io.IOException;

import java.net.DatagramPacket;

import java.net.DatagramSocket;

import java.net.InetAddress;

import java.net.SocketException;

import java.net.UnknownHostException;



public class UDPTimeClient {

public static void main(String[] args) 

throws SocketException, UnknownHostException, InterruptedException,

IOException {

DatagramSocket client = new DatagramSocket();   

for(int i = 0 ; i < 10 ; i++){

DatagramPacket sPacket = new DatagramPacket("".getBytes(), "".getBytes().length, InetAddress.getByName("localhost"), 9999);  //""를 주어 아무것도 안보냄... 왜그런진 몰라...ㅠㅠ

Thread.sleep(1000);

client.send(sPacket);

byte [] buffer = new byte[512];

DatagramPacket rPacket = new DatagramPacket(buffer, buffer.length);

client.receive(rPacket);

String msg = new String(buffer, 0, rPacket.getLength());

System.out.println(msg);

}

client.close();

}

}

출력:

지금은 2014-04-03 AM 10:33:23 입니다.

지금은 2014-04-03 AM 10:33:24 입니다.

지금은 2014-04-03 AM 10:33:25 입니다.

지금은 2014-04-03 AM 10:33:26 입니다.

지금은 2014-04-03 AM 10:33:27 입니다.

지금은 2014-04-03 AM 10:33:28 입니다.

지금은 2014-04-03 AM 10:33:29 입니다.

지금은 2014-04-03 AM 10:33:30 입니다.

지금은 2014-04-03 AM 10:33:31 입니다.

지금은 2014-04-03 AM 10:33:32 입니다.

----------------------------------------------------------

import java.net.DatagramPacket;

import java.net.DatagramSocket;

import java.net.SocketException;


public class UDPServer {

private DatagramSocket server;

private DatagramPacket rPacket, sPacket;

UDPServer(){

try{

this.server = new DatagramSocket(9999);

System.out.println("Server is ready...");

}catch(SocketException ex){

ex.printStackTrace();

}

}

private void service(){

try{

while(true){

byte [] buffer = new byte[512];

this.rPacket = new DatagramPacket(buffer, buffer.length);

this.server.receive(rPacket);

String msg = new String(buffer, 0, rPacket.getLength());

if(msg.equals("bye")) break;

System.out.println("Client 로 부터 받은 문자열 : " + msg);

this.sPacket = new DatagramPacket(

msg.getBytes(), msg.getBytes().length, 

rPacket.getAddress(), rPacket.getPort());

this.server.send(sPacket);

}

}catch(Exception ex){

ex.printStackTrace();

}finally{

System.out.println("Server is closed...");

try{

this.server.close();

}catch(Exception ex){}

}

}

public static void main(String[] args) {

new UDPServer().service();

}

}





import java.net.DatagramPacket;

import java.net.DatagramSocket;

import java.net.InetAddress;

import java.net.SocketException;

import java.util.Scanner;



public class UDPClient {

private DatagramSocket client;

private DatagramPacket rPacket, sPacket;

private Scanner scan;

UDPClient() {

try{

this.client = new DatagramSocket();

this.scan = new Scanner(System.in);

System.out.println("발송준비완료");

}catch(SocketException ex){

ex.printStackTrace();

}

}

private void service(){

String line = null;

try{

while(true){

System.out.print(">> ");

line = this.scan.nextLine();

if(line == null || line.equals("bye")){

line = "bye";

break;

}

this.sPacket = new DatagramPacket(line.getBytes(), line.getBytes().length,

                       InetAddress.getByName("localhost"), 9999);

this.client.send(sPacket);  //서버로 발송

byte [] buffer = new byte[512];

this.rPacket = new DatagramPacket(buffer, buffer.length);

this.client.receive(rPacket);

String msg = new String(buffer, 0, rPacket.getLength());

System.out.println("서버로부터 들어온 문자열 : " + msg);

}

}catch(Exception ex){

ex.printStackTrace();

}finally{

try{

this.client.close();

}catch(Exception ex){}

}

}

public static void main(String[] args) {

new UDPClient().service();

}

}

출력:

java UDPClient

발송준비완료

>> 헤헷

서버로부터 들어온 문자열 : 헤헷

>> 으음..

서버로부터 들어온 문자열 : 으음..

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

NIO

Byte Buffer

import java.nio.ByteBuffer;

// position <= limit <= capacity

public class BufferDemo {

public static void main(String[] args) {

ByteBuffer bb = ByteBuffer.allocate(12);  //12바이트로 만들어줌.

System.out.println(bb);  //처음에 position은 0, limit와 capacity는 12

bb.putInt(100);  //100이 4바이트를 차지하니, 포지션 4이동.

System.out.println(bb);  

bb.putDouble(89.5);  //더블형 8바이트가 들어왓으니 포지션 12.

System.out.println(bb);  

//bb.put((byte)5);  //오류발생. 포지션이 리미트를 넘어감

bb.rewind();  //position이 처음위치 0으로이동

System.out.println(bb);    

System.out.println(bb.getInt());

System.out.println(bb);

System.out.println(bb.getDouble());

System.out.println(bb);

}

}

출력:

java.nio.HeapByteBuffer[pos=0 lim=12 cap=12]

java.nio.HeapByteBuffer[pos=4 lim=12 cap=12]

java.nio.HeapByteBuffer[pos=12 lim=12 cap=12]

java.nio.HeapByteBuffer[pos=0 lim=12 cap=12]

100

java.nio.HeapByteBuffer[pos=4 lim=12 cap=12]

89.5

java.nio.HeapByteBuffer[pos=12 lim=12 cap=12]

----------------------

import java.nio.ByteBuffer;

public class BufferDemo {

public static void main(String[] args) {

ByteBuffer bb = ByteBuffer.allocate(12);  //12바이트로 만들어줌.

System.out.println(bb);  //처음에 position은 0, limit와 capacity는 12

bb.putInt(100);  //100이 4바이트를 차지하니, 포지션 4이동.

System.out.println(bb);

bb.flip();  //psition을 0으로 옮기고, 원래 position의 값은 lim로 바꿔줌.

System.out.println(bb);

}

}

출력:

java.nio.HeapByteBuffer[pos=0 lim=12 cap=12]

java.nio.HeapByteBuffer[pos=4 lim=12 cap=12]

java.nio.HeapByteBuffer[pos=0 lim=4 cap=12]

-----------------------------------------------------------

Int Buffer

import java.nio.IntBuffer;


public class BufferDemo1 {

public static void main(String[] args) {

IntBuffer ib = IntBuffer.allocate(10);  //int형으로 10칸할당해주어서 40바이트. 한칸당4바이트.

System.out.println(ib);

ib.put(4).put(5).put(6).put(7).put(8).put(9);

System.out.println(ib);

ib.flip();  //position은 0으로, 마지막 position의 위치를 limit로.

System.out.println(ib);

while(ib.hasRemaining()){  //ib의 값이 있을 때까지

System.out.print(ib.get() + ",");

}

}

}

출력:

java.nio.HeapIntBuffer[pos=0 lim=10 cap=10]

java.nio.HeapIntBuffer[pos=6 lim=10 cap=10]

java.nio.HeapIntBuffer[pos=0 lim=6 cap=10]

4,5,6,7,8,9,

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

속도측정 - IO

import java.io.IOException;


public class Main {

public static void main(String[] args) throws IOException{

FullBuffer.start();

FullBuffer.copy("/home/mino/Downloads/staruml.exe", "/home/mino/Temp/staruml.exe" );

FullBuffer.end();

long differ = FullBuffer.during();

System.out.println(differ + " ms");

}

}

위에 메인에서만 FullBuffer를 SmallBuffer, NonBuffer로 바꿔주어 실행해 보면 아래의 결과값.


버퍼링을 하지 않을때

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;


public class NonBuffer {

private static long start;

private static long end;

public static void start()  { start = System.currentTimeMillis(); }

public static void end()  { end = System.currentTimeMillis();  }

public static long during() { return end - start; }

public static void copy(String source, String target) throws IOException {

FileInputStream fis = new FileInputStream(source);

FileOutputStream fos = new FileOutputStream(target);

int su = 0 ;

while((su = fis.read()) != -1){

fos.write(su);

}

System.out.println("Copy End...");

}

}

출력:

Copy End...

42508 ms


버퍼링을 살짝 할때

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;


public class SmallBuffer {

private static long start;

private static long end;

public static void start()  { start = System.currentTimeMillis(); }

public static void end()  { end = System.currentTimeMillis();  }

public static long during() { return end - start; }

public static void copy(String source, String target) throws IOException {

FileInputStream fis = new FileInputStream(source);

FileOutputStream fos = new FileOutputStream(target);

int count = 0;

byte [] buffer = new byte[1024];

while((count = fis.read(buffer)) != -1){

fos.write(buffer, 0, count);

}

System.out.println("Copy End...");

}

}

출력:

Copy End...

88 ms


버퍼링을 완전 쓸때

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;


public class FullBuffer {

private static long start;

private static long end;

public static void start()  { start = System.currentTimeMillis(); }

public static void end()  { end = System.currentTimeMillis();  }

public static long during() { return end - start; }

public static void copy(String source, String target) throws IOException {

FileInputStream fis = new FileInputStream(source);

FileOutputStream fos = new FileOutputStream(target);

int count = 0;

byte [] buffer = new byte[fis.available()];

while((count = fis.read(buffer)) != -1){

fos.write(buffer, 0, count);

}

System.out.println("Copy End...");

}

}

출력:

Copy End...

57 ms


NIO로 했을때 

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;

import java.nio.MappedByteBuffer;

import java.nio.channels.FileChannel;

import java.nio.channels.FileChannel.MapMode;


public class FileChannelDemo {

private static long start;

private static long end;

public static void start()  { start = System.currentTimeMillis(); }

public static void end()  { end = System.currentTimeMillis();  }

public static long during() { return end - start; }

public static void copy(String source, String target) throws IOException {

FileInputStream fis = new FileInputStream(source);

FileOutputStream fos = new FileOutputStream(target);

FileChannel in = fis.getChannel();

FileChannel out = fos.getChannel();

MappedByteBuffer map = in.map(MapMode.READ_ONLY, 0, in.size()); //처음부터 파일채널의 사이즈만큼 읽어서

out.write(map);

System.out.println("Copy End...");

}

}

출력:

Copy End...

82 ms


in을 기준으로 transferTo를 써서 

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;

import java.nio.MappedByteBuffer;

import java.nio.channels.FileChannel;

import java.nio.channels.FileChannel.MapMode;


public class FileChannelDemo1 {

private static long start;

private static long end;

public static void start()  { start = System.currentTimeMillis(); }

public static void end()  { end = System.currentTimeMillis();  }

public static long during() { return end - start; }

public static void copy(String source, String target) throws IOException {

FileInputStream fis = new FileInputStream(source);

FileOutputStream fos = new FileOutputStream(target);

FileChannel in = fis.getChannel();

FileChannel out = fos.getChannel();

in.transferTo(0, in.size(), out);  //0~사이즈만큼 out 채널로 보냄.

System.out.println("Copy End...");

}

}

출력:

Copy End...

18 ms

output을 기준으로 transferFrom 사용

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;

import java.nio.channels.FileChannel;



public class FileChannelDemo2 {

private static long start;

private static long end;

public static void start()  { start = System.currentTimeMillis(); }

public static void end()  { end = System.currentTimeMillis();  }

public static long during() { return end - start; }

public static void copy(String source, String target) throws IOException {

FileInputStream fis = new FileInputStream(source);

FileOutputStream fos = new FileOutputStream(target);

FileChannel in = fis.getChannel();

FileChannel out = fos.getChannel();

out.transferFrom(in, 0, in.size());

System.out.println("Copy End...");

}

}

출력:

Copy End...

23 ms

//transferFrom을 쓰면 가장빠르다는데.. 왜 난 transferTo가 더빠르지..?

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

===================================================================

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ


                JDBC      

미리준비한 offic txt와 img파일을 vm윈도우로 옮겨줌.

데몬으로 설치해주고. Customize 선택해서 access 체크된것만 확인. 그리고 인스톨.

우편번호 다운. http://www.epost114.co.kr/ . 우편번호 다운로드 클릭.

우정사업본부 고시 우편번호 DB (현재 사용되고 있는 전체 우편번호 DB임) 다운로드.

실행하면 풀리면서 c:에 우편번호파일 폴더가 생김.

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

ODBC 설정. Control Panel\All Control Panel Items\Administrative Tools\ODBC Data Sources 들어가서

System DSN 탭에서 Add눌러서 .mdb or .accdb 택하고 확인. data source name에 이름(난 access) 써주고(ODBC 이름), 데이터베이스 선택 을 눌러서 사용할 액세스파일을 지정해줌. 확인 확인

아이디와 암호를 줄것이라면system DSN에서 아까만든 access를 configure 누른 후 오른쪽 advanced 누르면 아이디 비번을 정해줄 수 있다. 아디scott, 비번tiger  해줌.

그리고 이클립스에서 window- other perspective 에서 sql Explorer 선택.

new-connection profile에서 name은 아무거나, Driver는 jdbc odbc bridget 해주고 URL : jdbc:odbc:access(access는 아까정한 odbc이름). User는 아무거나.

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

우편번호 검색


// 1. import하자

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.util.Scanner;


public class JDBCDemo {

private static final String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";

private static final String URL = "jdbc:odbc:access";  //ODBC name

public static void main(String[] args) {

//2. Driver Loading

try{

Class.forName(DRIVER);

System.out.println("Driver loading Success");

}catch(ClassNotFoundException ex){

System.out.println("Class Not Found");

}

//3. Database Connection

Connection conn = null;

try{

conn = DriverManager.getConnection(URL);  //원래 아이디 비번도 같이 써줘야 하는데 우린 설정을 안해서 안넣음.

System.out.println("Connection Success");

}catch(SQLException ex){

System.out.println("Connect failure");

}

//4. Statement 객체 생성

Statement stmt = null;

ResultSet rs = null;  //결과를 가져올 때 사용

Scanner scan = new Scanner(System.in);

System.out.print("찾고자 하시는 동/읍/면 이름 : ");

String dongName = scan.nextLine().trim();

try{

stmt = conn.createStatement();

//5. Query 실행

String sql = "SELECT zipcode, sido, gugun, dong ";  //마지막 dong뒤에는 띄어야함.

sql += "FROM zipcode WHERE dong LIKE '%" + dongName + "%'";  //문자열이 데이터베이스는 '', 자바는"

rs = stmt.executeQuery(sql);  //결과값을 resultset에 넣어줌.

//6. Query 결과 수행

while(rs.next()){

String zipcode = rs.getString(1);  //JDBC는 인덱스가 1부터 시작.

String sido = rs.getString("sido");  //몇번짼지모르면 이름으로 불러와도됨.

String gugun = rs.getString("gugun");

String dong = rs.getString("dong");

System.out.printf("(%s) %s %s %s\n", zipcode, sido, gugun, dong);

}

rs.close();

stmt.close();

}catch(SQLException ex){

ex.printStackTrace();

}

//7.DB Close

try{  //닫는건 거꾸로

if(rs != null) conn.close();

}catch(SQLException ex){}

}

}

출력:
Driver loading Success
Connection Success
찾고자 하시는 동/읍/면 이름 : 상하
(446917) 경기도 용인시 기흥구 상하동
(446568) 경기도 용인시 기흥구 상하동
(446918) 경기도 용인시 기흥구 상하동
(446918) 경기도 용인시 기흥구 상하동
(446519) 경기도 용인시 기흥구 상하동
(446518) 경기도 용인시 기흥구 상하동
(446517) 경기도 용인시 기흥구 상하동
(446514) 경기도 용인시 기흥구 상하동
(446513) 경기도 용인시 기흥구 상하동
(446512) 경기도 용인시 기흥구 상하동
(446719) 경기도 용인시 기흥구 상하동
(446914) 경기도 용인시 기흥구 상하동
(446774) 경기도 용인시 기흥구 상하동
(446773) 경기도 용인시 기흥구 상하동
(446775) 경기도 용인시 기흥구 상하동
(446942) 경기도 용인시 기흥구 상하동
(446516) 경기도 용인시 기흥구 상하동
(446515) 경기도 용인시 기흥구 상하동
(446581) 경기도 용인시 기흥구 상하동
(446769) 경기도 용인시 기흥구 상하동
(585911) 전라북도 고창군 상하면
(585912) 전라북도 고창군 상하면
(585911) 전라북도 고창군 상하면
(585913) 전라북도 고창군 상하면
(585914) 전라북도 고창군 상하면
(585912) 전라북도 고창군 상하면
(585914) 전라북도 고창군 상하면
(585914) 전라북도 고창군 상하면
(585913) 전라북도 고창군 상하면
(585910) 전라북도 고창군 상하면
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
메모장을 열어 아래와 같이 적어서 저장해줌. dbinfo.properties 로 모든파일로 저장해서 d: downloads폴더에 저장.
DBDRIVER=sun.jdbc.odbc.JdbcOdbcDriver
DBURL=jdbc:odbc:access
DBUSER=scott
DBPWD=tiger


import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

public class JdbcSwing {
private JFrame f;
private JTextField tf;
private Container con;
private JTable table;
private JScrollPane pane;
private JdbcSwing(){
this.f = new JFrame("우편번호검색 프로그램");
this.con = this.f.getContentPane();
this.table = new JTable();
this.pane = new JScrollPane(this.table, 
                     JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, 
                     JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
this.tf = new JTextField();
}
private void display(){
this.con.setLayout(new BorderLayout());
this.tf.addActionListener(new ZipcodeController(this.f, this.table, this.tf));
this.con.add("North", this.tf);
this.con.add("Center", this.pane);
this.f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.f.setSize(800,400);
this.f.setVisible(true);
}
public static void main(String[] args) {
new JdbcSwing().display();
}
}




import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.JTextField;

public class ZipcodeController implements ActionListener{
private JFrame f;
private JTable table;
private JTextField tf;
public ZipcodeController(JFrame f, JTable table, JTextField tf) {
this.f = f;
this.table = table;
this.tf = tf;
}

@Override
public void actionPerformed(ActionEvent evt){
ZipcodeModel zm = new ZipcodeModel(this.f, this.tf.getText());
this.table.setModel(zm);
System.out.println(this.tf.getText());
}
}






import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
import java.util.Vector;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

public class ZipcodeModel extends DefaultTableModel{
private JFrame f;
private String dongName;
private Connection conn;
public ZipcodeModel(JFrame f, String dongName) {
this.f = f;
this.dongName = dongName;
Properties props = new Properties();
try{
props.load(new FileInputStream(new File("D:\\downloads\\dbinfo.properties")));
Class.forName(props.getProperty("DBDRIVER"));  //driver loading
this.conn = DriverManager.getConnection(props.getProperty("DBURL"),
                                      props.getProperty("DBUSER"),
                                      props.getProperty("DBPWD"));
JOptionPane.showMessageDialog(this.f, "Driver Loading & Connection Success");
}catch(ClassNotFoundException ex){
JOptionPane.showMessageDialog(this.f, "Class Not Found");
}catch(IOException ex){
JOptionPane.showMessageDialog(this.f, ex.getMessage());
}catch(SQLException ex){
JOptionPane.showMessageDialog(this.f, ex.getMessage());
}
this.getData();
}
private void getData(){
Statement stmt = null;
ResultSet rs = null;
Vector<Object> dataVector = new Vector<Object>(1,1);
String [] array = {"우편번호", "시도", "시군구", "읍면동", "리", "번지", "나머지주소"};
Vector<String> columnVector = new Vector<String>(1,1);
for(String str : array)  columnVector.addElement(str);
try{
stmt = this.conn.createStatement();
StringBuffer sb = new StringBuffer("SELECT zipcode, sido, gugun, dong, ri,");
sb.append("bunji, etc FROM zipcode WHERE dong LIKE '%");
sb.append(this.dongName + "%' ");
rs = stmt.executeQuery(sb.toString());
if(!rs.next()){
JOptionPane.showMessageDialog(this.f, "데이타가 없습니다.");
return;
}
do{
Vector<String> temp = new Vector<String>(1,1);
String zipcode = rs.getString("zipcode");  temp.addElement(zipcode);
String sido = rs.getString("sido");  temp.addElement(sido);
String gugun = rs.getString("gugun"); temp.addElement(gugun);
String dong = rs.getString("dong"); temp.addElement(dong);
String ri = rs.getString("ri");   if(ri == null) ri = "";
temp.addElement(ri);
String bunji = rs.getString("bunji");   if(bunji == null) bunji ="";
temp.addElement(bunji);
String etc = rs.getString("etc");   if(etc == null) etc = "";
temp.addElement(etc);
dataVector.addElement(temp);
}while(rs.next());
rs.close();
stmt.close();
this.conn.close();
}catch(SQLException ex){
JOptionPane.showMessageDialog(this.f, ex.getMessage());
}
this.setDataVector(dataVector, columnVector);
}
}
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

centos 설치(오늘은 다운만)

www.centos.org 접속. get centos linux now 선택. download now 선택. 

http://ftp.daum.net/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso  선택(빠른 것 아무거나 받아도됭)



+ Recent posts