Javaµ÷Óô洢¹ý³Ì
Javaµ÷Óô洢¹ý³Ì
±¾ÎIJûÊöÁËÔõôʹÓÃDBMS´æ´¢¹ý³Ì¡£ÎÒ²ûÊöÁËʹÓô洢¹ý³ÌµÄ»ù±¾µÄºÍ¸ß¼¶ÌØÐÔ£¬±ÈÈç·µ»ØResultSet¡£±¾ÎļÙÉèÄã¶ÔDBMSºÍJDBCÒѾ·Ç³£ÊìϤ£¬Ò²¼ÙÉèÄãÄܹ»ºÁÎÞÕÏ°µØÔĶÁÆäËüÓïÑÔд³ÉµÄ´úÂ루¼´²»ÊÇJavaµÄÓïÑÔ£©£¬µ«ÊÇ£¬²¢²»ÒªÇóÄãÓÐÈκδ洢¹ý³ÌµÄ±à³Ì¾Àú¡£
´æ´¢¹ý³ÌÊÇÖ¸±£´æÔÚÊý¾Ý¿â²¢ÔÚÊý¾Ý¿â¶ËÖ´ÐеijÌÐò¡£Äã¿ÉÒÔʹÓÃÌØÊâµÄÓï·¨ÔÚJavaÀàÖе÷Óô洢¹ý³Ì¡£ÔÚµ÷ÓÃʱ£¬´æ´¢¹ý³ÌµÄÃû³Æ¼°Ö¸¶¨µÄ²ÎÊýͨ¹ýJDBCÁ¬½Ó·¢Ë͸øDBMS£¬Ö´Ðд洢¹ý³Ì²¢Í¨¹ýÁ¬½Ó£¨Èç¹ûÓУ©·µ»Ø½á¹û¡£
ʹÓô洢¹ý³ÌÓµÓкÍʹÓûùÓÚEJB»òCORBAÕâÑùµÄÓ¦Ó÷þÎñÆ÷Ò»ÑùµÄºÃ´¦¡£Çø±ðÊÇ´æ´¢¹ý³Ì¿ÉÒԴӺܶàÁ÷ÐеÄDBMSÖÐÃâ·ÑʹÓ㬶øÓ¦Ó÷þÎñÆ÷´ó¶¼·Ç³£°º¹ó¡£Õâ²¢²»Ö»ÊÇÐí¿ÉÖ¤·ÑÓõÄÎÊÌ⡣ʹÓÃÓ¦Ó÷þÎñÆ÷ËùÐèÒª»¨·ÑµÄ¹ÜÀí¡¢±àд´úÂëµÄ·ÑÓã¬ÒÔ¼°¿Í»§³ÌÐòËùÔö¼ÓµÄ¸´ÔÓÐÔ£¬¶¼¿ÉÒÔͨ¹ýDBMSÖеĴ洢¹ý³ÌËùÕû¸öµØÌæ´ú¡£
Äã¿ÉÒÔʹÓÃJava£¬Python£¬Perl»òC±àд´æ´¢¹ý³Ì£¬µ«ÊÇͨ³£Ê¹ÓÃÄãµÄDBMSËùÖ¸¶¨µÄÌض¨ÓïÑÔ¡£OracleʹÓÃPL/SQL£¬PostgreSQLʹÓÃpl/pgsql£¬DB2ʹÓÃProcedural SQL¡£ÕâЩÓïÑÔ¶¼·Ç³£ÏàËÆ¡£ÔÚËüÃÇÖ®¼äÒÆÖ²´æ´¢¹ý³Ì²¢²»±ÈÔÚSunµÄEJB¹æ·¶²»Í¬ÊµÏÖ°æ±¾Ö®¼äÒÆÖ²Session BeanÀ§ÄÑ¡£²¢ÇÒ£¬´æ´¢¹ý³ÌÊÇΪǶÈëSQLËùÉè¼Æ£¬ÕâʹµÃËüÃDZÈJava»òCµÈÓïÑÔ¸ü¼ÓÓѺõط½Ê½±í´ïÊý¾Ý¿âµÄ»úÖÆ¡£ ×Ö´®1
ÒòΪ´æ´¢¹ý³ÌÔËÐÐÔÚDBMS×ÔÉí£¬Õâ¿ÉÒÔ°ïÖú¼õÉÙÓ¦ÓóÌÐòÖеĵȴýʱ¼ä¡£²»ÊÇÔÚJava´úÂëÖÐÖ´ÐÐ4¸ö»ò5¸öSQLÓï¾ä£¬¶øÖ»ÐèÒªÔÚ·þÎñÆ÷¶ËÖ´ÐÐ1¸ö´æ´¢¹ý³Ì¡£ÍøÂçÉϵÄÊý¾ÝÍù·µ´ÎÊýµÄ¼õÉÙ¿ÉÒÔÏ·¾çÐÔµØÓÅ»¯ÐÔÄÜ¡£
ʹÓô洢¹ý³Ì
¼òµ¥µÄÀϵÄJDBCͨ¹ýCallableStatementÀàÖ§³Ö´æ´¢¹ý³ÌµÄµ÷Ó᣸ÃÀàʵ¼ÊÉÏÊÇPreparedStatementµÄÒ»¸ö×ÓÀà¡£¼ÙÉèÎÒÃÇÓÐÒ»¸öpoetsÊý¾Ý¿â¡£Êý¾Ý¿âÖÐÓÐÒ»¸öÉèÖÃÊ«ÈËÊÅÊÀÄêÁäµÄ´æ´¢¹ý³Ì¡£ÏÂÃæÊǶÔÀϾƹíDylan Thomas£¨old soak Dylan Thomas£¬²»Ö¸¶¨ÊÇ·ñÓйصä¹Ê¡¢ÎÄ»¯£¬ÇëÅúÆÀÖ¸Õý¡£Òë×¢£©½øÐе÷ÓõÄÏêϸ´úÂ룺
try{
int age = 39;
String poetName = "dylan thomas";
CallableStatement proc = connection.prepareCall("{ call set_death_age(?, ?) }");
proc.setString(1, poetName);
proc.setInt(2, age);
cs.execute();
}catch (SQLException e){ // ....} ×Ö´®7
´«¸øprepareCall·½·¨µÄ×Ö´®ÊÇ´æ´¢¹ý³Ìµ÷ÓõÄÊéд¹æ·¶¡£ËüÖ¸¶¨ÁË´æ´¢¹ý³ÌµÄÃû³Æ£¬£¿´ú±íÁËÄãÐèÒªÖ¸¶¨µÄ²ÎÊý¡£
ºÍJDBC¼¯³ÉÊÇ´æ´¢¹ý³ÌµÄÒ»¸öºÜ´óµÄ±ãÀ
Ïà¹ØÎĵµ£º
¡¡JavaÓïÑÔµÄÊäÈëÊä³ö¹¦ÄÜÊÇÊ®·ÖÇ¿´ó¶øÁé»îµÄ£¬ÃÀÖв»×ãµÄÊÇ¿´ÉÏÈ¥ÊäÈëÊä³öµÄ´úÂë²¢²»ÊǺܼò½à£¬ÒòΪÄãÍùÍùÐèÒª°ü×°Ðí¶à²»Í¬µÄ¶ÔÏó¡£ÔÚJavaÀà¿âÖУ¬IO²¿·ÖµÄÄÚÈÝÊǺÜÅÓ´óµÄ£¬ÒòΪËüÉæ¼°µÄÁìÓòºÜ¹ã·º:±ê×¼ÊäÈëÊä³ö£¬ÎļþµÄ²Ù×÷£¬ÍøÂçÉϵÄÊý¾ÝÁ÷£¬×Ö·û´®Á÷£¬¶ÔÏóÁ÷£¬zipÎļþÁ÷....±¾ÎĵÄÄ¿µÄÊÇΪ´ó¼Ò×öÒ»¸ö¼òÒªµÄ½éÉÜ¡£
¡¡¡ ......
ÔÎÄ£ºhttp://zhaosoft.javaeye.com/blog/243586
Java
»ù±¾¸ÅÄ¼¯ºÏÀࣨCollection
£© List
/Set/Map µÄÇø±ðºÍÁªÏµ
Collection
£ºList
¡¢Set
Map£ºHashMap¡¢HashTable
ÈçºÎÔÚËüÃÇÖ®¼äÑ¡Ôñ
Ò»¡¢Array £¬ Arrays
Java
ËùÓГ´æ´¢¼°Ëæ»ú·ÃÎÊÒ»Á¬´®¶ÔÏó”µÄ×ö·¨£¬arrayÊÇ×îÓÐЧÂʵÄÒ»ÖÖ¡£
1¡¢ ......
SpringÄÜÓÐЧµØ×éÖ¯J2EEÓ¦Óø÷²ãµÄ¶ÔÏó¡£²»¹ÜÊÇ¿ØÖƲãµÄAction¶ÔÏ󣬻¹ÊÇÒµÎñ²ãµÄService¶ÔÏ󣬻¹Êdz־òãµÄDAO¶ÔÏ󣬶¼¿ÉÔÚSpringµÄ¹ÜÀíÏÂÓлúµØе÷¡¢ÔËÐС£Spring½«¸÷²ãµÄ¶ÔÏóÒÔËÉñîºÏµÄ·½Ê½×éÖ¯ÔÚÒ»Æð£¬Action¶ÔÏóÎÞÐë¹ØÐÄService¶ÔÏóµÄ¾ßÌåʵÏÖ£¬Service¶ÔÏóÎÞÐë¹ØÐij־òã¶ÔÏóµÄ¾ßÌåʵÏÖ£¬¸÷²ã¶ÔÏóµÄµ÷ÓÃÍêÈ«ÃæÏò½Ó ......
ÔںܶàJavaÓ¦ÓÃÖÐÐèÒªÔÚ³ÌÐòÖе÷ÓÃJava±àÒëÆ÷À´±àÒëºÍÔËÐС£µ«ÔÚÔçÆڵİ汾ÖУ¨Java SE5¼°ÒÔÇ°°æ±¾£©ÖÐÖ»ÄÜͨ¹ýtools.jarÖеÄcom.sun.tools.javac°üÀ´µ÷ÓÃJava±àÒëÆ÷£¬µ«ÓÉÓÚtools.jar²»ÊDZê×¼µÄJava¿â£¬ÔÚʹÓÃʱ±ØÐëÒªÉèÖÃÕâ¸öjarµÄ·¾¶¡£¶øÔÚJava SE6ÖÐΪÎÒÃÇÌṩÁ˱ê×¼µÄ°üÀ´²Ù×÷Java±àÒëÆ÷£¬Õâ¾ÍÊÇjavax.tools°ü¡£Ê¹ÓÃÕ ......
ºÜ¶àÍøÓÑÎÊÎÒѧϰJavaÓÐûÓÐʲô½Ý¾¶,ÎÒ˵“ÎÞËû£¬Î¨ÊÖÊì¶û”¡£µ«ÊÇÎÒÈ´ºÜÔ¸Ò⽫×Ô¼ºÑ§Ï°µÄһЩ¾Ñéд³öÀ´£¬ÒÔ±ãºóÀ´ÕßÉÙ×ßÍä·,°ïÖú±ðÈËÊÇ×î´óµÄ¿ìÀÖÂ
ÒªÏëѧºÃJava£¬Ê×ÏÈÒªÖªµÀJavaµÄ´óÖ·ÖÀà¡£ÎÒÃÇÖªµÀ£¬×Ô´ÓSunÍƳöJavaÒÔÀ´£¬¾ÍÁ¦Í¼Ê¹Ö®ÎÞËù²»°ü£¬ËùÒÔJava·¢Õ¹µ½ÏÖÔÚ£¬°´Ó¦ÓÃÀ´·ÖÖ÷Òª·ÖΪÈý´ó¿é£ºJ2SE,J2 ......