자바스윙과 오라클 자바JDBC를 이용한 예제, JAVA SWING, JAVA교육,자바교육,자바강좌,자바강의
| [예제]Swing과 JDBC(오라클)를 이용한 예제 |
 |
 |
//오라클의 EMP Table의 데이터를 가지고 화면에 뿌리는 예제 //이름을 입력하고 Enter Key를
누르면 JDBC를 이용하여 데이터를 가지고 옵니다.
import java.awt.*; import
java.awt.event.*; import javax.swing.*; import
javax.swing.event.*; import java.sql.*;
class DBTest
{ JTextField name; JPasswordField tel; JTextField
addr; public DBTest() { JFrame f = new
JFrame(); Container cp =
f.getContentPane(); cp.setLayout(new
FlowLayout()); name = new
JTextField("",10); name.setCaretColor(Color.blue); tel =
new
JPasswordField("",10); tel.setEditable(false); addr
= new
JTextField("",10); addr.setEditable(false); cp.add(new
JLabel("성명 : ")); cp.add(name); cp.add(new
JLabel("전화번호 : ")); cp.add(tel); cp.add(new JLabel("주소 : "));
cp.add(addr);
name.addActionListener( new
ActionListener()
{ public void
actionPerformed(ActionEvent ae)
{ dataGet(); } } ); f.setSize(600,
100); f.setVisible(true); } public
static void main(String[] args) { new
DBTest(); }
public void dataGet()
{ Connection con=null; Statement
stmt=null; ResultSet rs=null; try
{ Class.forName("oracle.jdbc.driver.OracleDriver");
con =
DriverManager.getConnection("jdbc:oracle:thin:@***.***.***.***:1521:WINK",
"test", "test"); stmt =
con.createStatement(); rs = stmt.executeQuery("select tel,
addr from emp where name = " + "'" + name.getText().trim() +
"'"); if (rs!=null)
{
rs.next(); tel.setText(rs.getString("tel")); addr.setText(rs.getString("addr")); } } catch(Exception
e) {System.out.println(e);} finally {
try { if
(con != null) {con.close();
} } catch
(Exception e){} } } }
오라클자바커뮤니티 실전 개발자 과정 - 개인80%환급
 |
Spring3.X, MyBatis, Hibernate실무과정
|
총 |
5일 |
35시간 |
|
09-24
|
[기업특강]JAVA,JSP,AJAX,jQUERY
|
총 |
5일 |
40시간 |
|
09-26
|
스프링3.X게시판&오라클힌트,SQL튜닝,사례연구
|
총 |
4일 |
32시간 |
|
09-27 |
 |
JAVA&WEB프레임워크실무과정
|
총 |
33일 |
99시간 |
|
09-13 |
자바초보에서안드로이드까지 |
총 |
18일 |
54시간 |
|
09-25
|
Spring3.X, MyBatis, Hibernate실무과정
|
총 |
12일 |
36시간 |
|
09-26
|
스프링3.X게시판&오라클힌트,SQL튜닝,사례연구
|
총 |
11일 |
33시간 |
|
09-26
|
자바기초에서JSP,Ajax,jQuery,Spring3.2,MyBatis까지
|
총 |
24일 |
72시간 |
|
09-26
|
JAVA,JSP 초보에서 실무까지 |
총 |
18일 |
56시간 |
|
10-02 |
 |
자바초보에서안드로이드까지
|
총 |
8일 |
56시간 |
|
09-14 |
Spring3.X, MyBatis,
Hibernate실무과정 |
총 |
5일 |
35시간 |
|
09-14 |
자바기초에서JSP,Ajax,jQuery,Spring3.2,MyBatis까지
|
총 |
10일 |
70시간 |
|
09-14 |
MiPlatform, XPlatform 실무강좌
|
총 |
5일 |
35시간 |
|
09-28
|
스프링3.X게시판&오라클힌트,SQL튜닝,사례연구
|
총 |
4일 |
32시간 |
|
09-28
|
JAVA&WEB프레임워크실무과정 |
총 |
14일 |
98시간 |
|
09-28 |
|
|
댓글 없음:
댓글 쓰기