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");//·µ»ØµÄÊÇÒ»¸
Ïà¹ØÎĵµ£º
1. ¹ØÓÚConnection Pool
JDBC±¾Éí²»ÌṩÁ¬½Ó³Ø¼¼Êõ£¬ÐèÒªµÚÈý·½¿âµÄÖ§³Ö¡£
ÔÚÐèҪƵ·±»ñµÃÁ¬½ÓµÄApplicationÖÐ×îºÃÓÃConnection Pool£¬ÈçWeb ApplicationÖÐ
¶ÔÓÚÒ»°ãµÄJava ApplicationÔò¿ÉÒÔÖ±½ÓÓÃJDBCÁ¬½ÓÊý¾Ý¿â¡£
2. Java ApplicationÖÐÁ¬½ÓDB2
°²×°DB2 Personal Edition V9Ö®ºó£¬ÔÚÆäÖ ......
¡¡1¡¢Ê¹ÓÃjava.util.ResourceBundleÀàµÄgetBundle()·½·¨
ʾÀý£º
String name = "logging"; // the logging.properties file in src root folder
ResourceBundle rb = ResourceBundle.getBundle(name,Locale.getDefault());
// test the rb
String propertyKey = "xxx";
System.out.println(rb.getString(propert ......
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFrame;
import j ......
µÚÒ»£¬Ì¸Ì¸final, finally, finalizeµÄÇø±ð¡£
¡¡final ÓÃÓÚÉùÃ÷ÊôÐÔ£¬·½·¨ºÍÀ࣬·Ö±ð±íʾÊôÐÔ²»¿É±ä£¬·½·¨²»¿É¸²¸Ç£¬À಻¿É¼Ì³Ð¡£finallyÊÇÒì³£´¦ÀíÓï¾ä½á¹¹µÄÒ»²¿·Ö£¬±íʾ×ÜÊÇÖ´ÐС£finalizeÊÇ ObjectÀàµÄÒ»¸ö·½·¨£¬ÔÚÀ¬»øÊÕ¼¯Æ÷Ö´ÐеÄʱºò»áµ÷Óñ»»ØÊÕ¶ÔÏóµÄ´Ë·½·¨£¬¿ÉÒÔ¸²¸Ç´Ë·½·¨ÌṩÀ¬»øÊÕ¼¯Ê± ......
×Ô¶¨ÒåµÄKeyÀàÐèÒªÖØÔØequals, hashCodeº¯Êý¡£¡£
package com.albert.test;
import java.util.Vector;
import java.util.HashMap;
/**
* @author tough_guy
*
*/
//¶ÔÓÚ×Ô¶¨ÒåµÄkey£¬ ÐèÒªÖØÔØhashCodeº¯ÊýºÍequalsº¯Êý
class IPSegment
{
long ip_s;
long ip_e;
int p;
IPSegment Reset(long f ......