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¼¯³ÉÊÇ´æ´¢¹ý³ÌµÄÒ»¸öºÜ´óµÄ±ãÀ
Ïà¹ØÎĵµ£º
Properties props=System.getProperties(); //ϵͳÊôÐÔ
System.out.println("JavaµÄÔËÐл·¾³°æ±¾£º"+props.getProperty("java.version"));
System.out.println("JavaµÄÔËÐл·¾³¹©Ó¦ÉÌ£º"+props.getProperty("java.vendor"));
System.out ......
InputSteam,OutputStream:¶Ô×ֽڵIJÙ×÷
Reader,Writer:¶Ô×Ö·ûµÄ²Ù×÷
InputStreamReader,OutputStreamReader:×Ö½Ú->×Ö·ûµÄת»»,×Ö·û->×Ö½ÚµÄת»»
FilterInputSteam,FilterOutputStream:¹ýÂË×Ö½ÚÊäÈëÁ÷(Êä³öÁ÷)µÄ³¬Àà
FilterReader,FilterWriter:¹ýÂË×Ö·ûÊäÈëÁ÷(Êä³öÁ÷)µÄ³¬Àà
BufferedInputStream,BufferedOutp ......
¿ÉÒÔ°ÑÆÕͨµÄJava³ÌÐò×ö³ÉÕæÕýµÄexe,Ò²¾ÍÊǵ¥Ò»¸öexe¾Í¿ÉÒÔÔÚûÓа²×°JVMµÄ»úÆ÷ÉÏÔËÐС£ÕâÑùµÄ¹¤¾ß³£¼ûµÄÓÐJETºÍgcj.Ç°ÕßÊÇÊշѵģ¬¶øÇÒ×ö³öÀ´µÄexe»¹ÊÇÐèÒªÒ»¶Ñdll¡£ÍƼöʹÓÃgcj.ËûÓÐwindowsºÍLinux°æ£¬Ö±½ÓÏÂÔØzip°ü£¬²»ÐèÒª°²×°£¬ÀïÃæÓв»ÉÙÀý×Ó£¬Ò»Ð©buildµÄÅú´¦ÀíÎļþ¡£´ÓÔÀíÀ´Ëµgcj×Ô¼ºÊµÏÖÁËJVM¹æ·¶£¬Ò²¾ÍÊÇÄ ......
ºÜ¶àÍøÓÑÎÊÎÒѧϰJavaÓÐûÓÐʲô½Ý¾¶,ÎÒ˵“ÎÞËû£¬Î¨ÊÖÊì¶û”¡£µ«ÊÇÎÒÈ´ºÜÔ¸Ò⽫×Ô¼ºÑ§Ï°µÄһЩ¾Ñéд³öÀ´£¬ÒÔ±ãºóÀ´ÕßÉÙ×ßÍä·,°ïÖú±ðÈËÊÇ×î´óµÄ¿ìÀÖÂ
ÒªÏëѧºÃJava£¬Ê×ÏÈÒªÖªµÀJavaµÄ´óÖ·ÖÀà¡£ÎÒÃÇÖªµÀ£¬×Ô´ÓSunÍƳöJavaÒÔÀ´£¬¾ÍÁ¦Í¼Ê¹Ö®ÎÞËù²»°ü£¬ËùÒÔJava·¢Õ¹µ½ÏÖÔÚ£¬°´Ó¦ÓÃÀ´·ÖÖ÷Òª·ÖΪÈý´ó¿é£ºJ2SE,J2 ......