Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javaÈÕÆڵĴ¦Àí

   
 
                                   ÏÂÃæÊdz£Óô¦ÀíÈÕÆڵķ½·¨£¬Ï£Íû¶Ô´ó¼ÒÓÐÓã¡
   ÔÚÎÒmysql Êý¾Ý¿âÖÐÓÐÕÅBlog±íµÄ×Ö¶ÎΪDateÐÍ£¬ÎÒÃǾ­³£×öµÄÊÇ°ÑËüÈ¡³öÀ´·ÅÔÚÒ³ÃæÉÏÏÔʾ¾ßÌåµÄÄêÔÂÈÕ»ò°üÀ¨Ê±·ÖÃë £¡
 
 public static String DRIVER = "com.mysql.jdbc.Driver";
 public static String URL = "jdbc:mysql://localhost:3306/blog";
 public static String USERNAME = "root";
 public static String PASSWORD = "123";
 
 
/**
  * @param args
  * ºÍÊý¾Ý¿â´ò½»µÀµÄÀà
  * java sql.Date  ÈÕÆÚÀà
  * java sql Time  ʱ¼äÀà
  * java sql Timestamp ÈÕÆÚʱ¼äÀà
  * ÕâÈý¸öÀ඼¼Ì³Ð java .util Date 
  * ͨ¹ýSimpleDataFormat ½øÐиñʽ»¯
  * java .util .Calendar ÈÕÀúÀà¿ÉÒÔÈ¡µÃËùÓж«Î÷ Ëü¼Ì³ÐObjectÀà
  * java .util .Timezone  ʱÇøÀà ´«½øÒ»¸öCalendar  Ò»°ãÎÒÃǵõ½µÄCalendarÊÇϵͳĬÈϵÄʱȥ  ÒªÉèÖÃʱÇø´«½øÒ»¸öCalendar ¼´¿É
  */
   public static void main(String[] args) {
  
  Connection conn  = null;
  PreparedStatement ps = null;
  ResultSet rs  = null;
  
  try {
   Class.forName(DRIVER);
       conn = DriverManager.getConnection(URL, USERNAME,
     PASSWORD);
   String sql  = "select birthday from date";
   ps  =conn.prepareStatement(sql);
   rs = ps.executeQuery();
   
   while(rs.next())
    
   {  
 
    °ÑÊý¾Ý¿âÖеÄDateÐÐת»»ÎªStringÐР Date ÀàÐÍÖ»ÄÜÄõ½ÈÕÆÚ ²»ÄÜÄõ½Ê±¼ä
    Date date =rs.getDate("birthday");//·µ»ØµÄÊÇÒ»¸


Ïà¹ØÎĵµ£º

JavaÁ¬½ÓDB2Ïà¹Ø

1. ¹ØÓÚConnection Pool
JDBC±¾Éí²»ÌṩÁ¬½Ó³Ø¼¼Êõ£¬ÐèÒªµÚÈý·½¿âµÄÖ§³Ö¡£
ÔÚÐèҪƵ·±»ñµÃÁ¬½ÓµÄApplicationÖÐ×îºÃÓÃConnection Pool£¬ÈçWeb ApplicationÖÐ
¶ÔÓÚÒ»°ãµÄJava ApplicationÔò¿ÉÒÔÖ±½ÓÓÃJDBCÁ¬½ÓÊý¾Ý¿â¡£
 
2. Java ApplicationÖÐÁ¬½ÓDB2
    °²×°DB2 Personal Edition V9Ö®ºó£¬ÔÚÆäÖ ......

[תÔØ]javaÖеÄ×¢Ê͹淶

 JAVA×¢ÊÍ·½·¨¼°¸ñʽ
1¡¢µ¥ÐÐ(single-line)--¶Ì×¢ÊÍ£º//……   
µ¥¶ÀÐÐ×¢ÊÍ£ºÔÚ´úÂëÖе¥ÆðÒ»ÐÐ×¢ÊÍ£¬ ×¢ÊÍÇ°×îºÃÓÐÒ»ÐпÕÐУ¬²¢ÓëÆäºóµÄ´úÂë¾ßÓÐÒ»ÑùµÄËõ½ø²ã¼¶¡£Èç¹ûµ¥ÐÐÎÞ·¨Íê³É£¬ÔòÓ¦²ÉÓÿé×¢ÊÍ¡£
×¢Ê͸ñʽ£º/* ×¢ÊÍÄÚÈÝ */
ÐÐÍ·×¢ÊÍ£ºÔÚ´úÂëÐеĿªÍ·½øÐÐ×¢ÊÍ¡£Ö÷ҪΪÁËʹ¸ÃÐд ......

ʹÓÃJavaʵÏÖ¶ÔMySqlÊý¾Ý¿âµÄµ¼ÈëÓëµ¼³ö

package com.project.ajaxs;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.Calendar;
import java.uti ......

תÌù£ºJavaÓïÑÔµÄÊ®´óÎÊÌâ¼°ÒýÉê˼¿¼

ת×Ô£ºhttp://blog.163.com/gordonkkk/blog/static/63425684200962795039630/
´ÓCSDNÉÏ¿´µ½Ò»ÆªÅúÆÀJavaÓïÑÔÖî¶àÎÊÌâµÄ·­ÒëÎÄÕ£¬Ô­ÎÄ×÷ÕßÊÇMario Fusco¡£ËûÖ¸³öÁËJavaÓïÑÔÂäºóÓÚʱ´ú£¬»ýÖØÄÑ·µµÄ10¸öÎÊÌâ¡£¿´¹ýÖ®ºóÒýÆðÁËÎÒµÄһЩÁªÏë¡£ÏÂÃæÁгöËûËù˵µÄ10´óÎÊÌâ¡£½Û»ÆÉ«×ÖÌåÊÇÎÒÒ»µãµã²»³ÉÊìµÄ˼¿¼¡£
1¡¢È±ÉÙ±Õ°ü£¨clos ......

java³ÌÐòÔ±ÃæÊԱر¸32Òªµã


µÚÒ»£¬Ì¸Ì¸final, finally, finalizeµÄÇø±ð¡£
¡¡final ÓÃÓÚÉùÃ÷ÊôÐÔ£¬·½·¨ºÍÀ࣬·Ö±ð±íʾÊôÐÔ²»¿É±ä£¬·½·¨²»¿É¸²¸Ç£¬À಻¿É¼Ì³Ð¡£finallyÊÇÒì³£´¦ÀíÓï¾ä½á¹¹µÄÒ»²¿·Ö£¬±íʾ×ÜÊÇÖ´ÐС£finalizeÊÇ ObjectÀàµÄÒ»¸ö·½·¨£¬ÔÚÀ¬»øÊÕ¼¯Æ÷Ö´ÐеÄʱºò»áµ÷Óñ»»ØÊÕ¶ÔÏóµÄ´Ë·½·¨£¬¿ÉÒÔ¸²¸Ç´Ë·½·¨ÌṩÀ¬»øÊÕ¼¯Ê± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ