SQL Server 2000 Java¿ª·¢Öе±Ç°ÈÕÆڵĴ¦Àí
1¡¢ÔÚÊý¾Ý¿â½¨±íµÄʱºò×Ö¶ÎÖ±½ÓÉèÖÃΪDATETIMEÀàÐÍ£»
2¡¢Ö´ÐвåÈëµÄʱºòʹÓÃÈçÏÂÓï¾ä£º
PreparedStatement pstmt = conn.prepareStatement("insert into guestbook(gst_user,gst_title,gst_content,gst_ip,gst_time) values(?,?,?,?,getdate())");
3¡¢Òª°ÑÈÕÆÚ´ÓÊý¾Ý¿âÖÐÈ¡³ö£¬Ö´ÐÐÈçÏÂÓï¾ä£º
Timestamp ts = rs.getTimestamp("gst_time");
long lms = ts.getTime();
Date date = new Date(lms);
Time time = new Time(lms);
×îÖվͿÉÒÔÖ±½ÓʹÓÃdateºÍtimeÁË¡£
out.println("ÁôÑÔʱ¼ä£º" + date + " " + time);
Ïà¹ØÎĵµ£º
¡¡¡¡JavaÓïÑÔµÄÊäÈëÊä³ö¹¦ÄÜÊÇÊ®·ÖÇ¿´ó¶øÁé»îµÄ£¬ÃÀÖв»×ãµÄÊÇ¿´ÉÏÈ¥ÊäÈëÊä³öµÄ´úÂë²¢²»ÊǺܼò½à£¬ÒòΪÄãÍùÍùÐèÒª°ü×°Ðí¶à²»Í¬µÄ¶ÔÏó¡£ÔÚJavaÀà¿âÖУ¬IO²¿·ÖµÄÄÚÈÝÊǺÜÅÓ´óµÄ£¬ÒòΪËüÉæ¼°µÄÁìÓòºÜ¹ã·º:±ê×¼ÊäÈëÊä³ö£¬ÎļþµÄ²Ù×÷£¬ÍøÂçÉϵÄÊý¾ÝÁ÷£¬×Ö·û´®Á÷£¬¶ÔÏóÁ÷£¬zipÎļþÁ÷....±¾ÎĵÄÄ¿µÄÊÇΪ´ó¼Ò×öÒ»¸ö¼òÒªµÄ½éÉÜ ......
Ò»£ºSelectÓï¾ä£º
select ×Ö¶ÎÃû from ±íÃû where Ìõ¼þ order by ÅÅÐò
see:select distinct ´Ó¶à¸öÏàͬ×Ö¶ÎÖÐץΨһֵ
see:²éÕÒld_det_andy±íÖÐÓÐÊý¾Ýµ«ld_det_temp±íÖÐûÊý¾ÝµÄÊý¾Ý
select * from ld_det_a ......
DB2 SQL PL
SQL PLÊÇDB2ËùÖ§³ÖµÄ¹ý³Ì»¯ÓïÑÔ£¬ËüÊÇSQL/PSM±ê×¼µÄÒ»¸ö×Ó¼¯¡£Æä¸ù¾ÝÓ¦Ó÷¶Î§²»Í¬£¬ÓÖ·ÖΪInline SQL PL£¬Embeded SQL PLºÍCompiled SQL PL¡£
Inline SQL PL
ÊÊÓ÷¶Î§£º´¥·¢Æ÷¡¢º¯ÊýºÍ·½·¨£¬Ö§³Ö²¿·ÖSQL PL£¬Ê¹ÓÃʱҪעÒâһЩÏÞÖÆ
Óï·¨¹æÔò£ºBEGIN ATOMIC ... END
Embeded SQL PL
ÊÊÓ÷¶Î§£ºÇ¶Èëʽ£¬Åäº ......
ÔÚiBatis 2.xÖУ¬¿ÉÒÔʹÓÃ$xxxx$Óï·¨ÔÚSQLÖж¨Òå¿É¶¯Ì¬²åÈëµÄSQLÔªËØ¡£¶øÔÚiBatis 3.xÖÐÒѾ·¢ÉúÁ˺ܴó±ä»¯¡£
Ê×ÏÈ£¬Óï·¨±äΪ ${xxxx} ÐÎʽ£»
Æäʵ£¬ÄãҪʹÓõÄSQLÔªËرØÐëÊÇÒ»¸öJava BeanµÄÊôÐÔ£¬Ò²ËµÊÇÊäÈë²ÎÊý±ØÐëΪJava Bean£»ÔÚ˵Ã÷ÎĵµÖÐҲûÓÐ˵Ã÷ÈçºÎÖ±½ÓʹÓÃÒ»¸öStringÀàÐ͵ÄÊäÈë²ÎÊý¡£
ÓÚÊÇ£¬ÎÒÓÃDEBUG·ÖÎöÁËi ......