java Á¬½Ó sql 2005 µÄ·½·¨
java Á¬½Ó sql 2005 µÄ·½·¨£º
1¡£µ½Î¢Èí¹Ù·½ÍøÕ¾ÏÂÔØ2005µÄjdbc²¢½âѹ£¬»ñµÃÎļþsqljdbc.jar
2¡£¸´ÖÆÎļþsqljdbc.jarµ½jdkĿ¼\jdk1.5\jre\lib\extÏ¡£
3¡£¿ªÊ¼-¡µ³ÌÐò-¡µsql server 2005-¡µÅäÖù¤¾ß-¡µSQL Server Configuration Manager¡£Æô¶¯sql 2005·þÎñ¡£
µã»÷ sql server2005ÍøÂçÅäÖýڵ㣬²¢Ñ¡ÖДMSSQLserverµÄÐÒ铽ڵ㡣ÆôÓÃtcp/ipÐÒé¡£
4¡£µ¼Èë java.sql.* °ü¡£ 5¡£ÔØÈësql server 2005 jdbcÇý¶¯³ÌÐò¡£
´úÂëƬ¶ÏÈçÏ£º
try{ Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
} catch(Exception e) {};
6¡£ÉèÖÃÁ¬½Ó×Ö·û´®¡£´úÂëƬ¶ÏÈçÏ£º
String connectionUrl ="jdbc:sqlserver://localhost:1433;database=bank;user=sa;password=";
7¡£¸ù¾ÝÁ¬½Ó´®»ñÈ¡µ½Êý¾Ý¿âµÄÁ¬½Ó¡£´úÂëƬ¶ÏÈçÏ£º
Connection con = DriverManager.getConnection(connectionUrl);
8¡£¸ù¾ÝËù»ñÈ¡µÄÁ¬½ÓÉèÖÃsqlÓï¾ä¶ÔÏóµÄÊôÐÔ¡£´úÂëƬ¶ÏÈçÏ£º Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
9¡£×¼±¸ÒªÖ´ÐеÄsqlÓï¾ä×Ö·û´®¡£²¢°Ñ¸Ã×Ö·û´®´«¸øsqlÓï¾ä¶ÔÏó¡£Ö´Ðнá¹û±£´æÔÚÒ»¸ö½á¹û¼¯ÖС£
String str = "select * from tableName"; ResultSet rs = stmt.executeQuery(str);
10¡£±éÀú½á¹û¼¯ºÏ£¬²¢»ñÈ¡Óû§ÐèÒªµÄÐÅÏ¢¡£ while (rs.next()) { System.out.println(rs.getInt("aid"));/*aidÊÇ×Ö¶ÎÃû³Æ*/ }
Ïà¹ØÎĵµ£º
mysqlÊýÖµ·¶Î§
tinyint -128~127 0~255
smallint -32768~32767 0~65535
mediumint -8388608~8388607 0~16777215
int -2147483648~2147483647 0~4294967295
bigint -9223372036854775808~9223372036854775807 0~18446744073709551615
javaÖÐ
byte ......
ÔÚJavaÀïÃ棬Á½¸öÕûÊýÏà³ýµÃµ½ÊǸöÕûÊý£¬±ÈÈç int a = 28;
int b = 10;
a/b == 2; //true
ÔÚFlexÖУ¬ÉÏÃæJava´úÂ뽫·µ»ØͬÑùµÄ½á¹û¡£ÖµµÃ×¢ÒâµÄÊÇ£¬Èç¹ûʹÓõÄÊÇNumberÀ࣬ÔòÓÐËù²»Ò»ÑùÁË¡£ÏÂÃæµÄ´úÂëÖУ¬resultµÄֵΪ2.8¡£Èç¹ûÄ㲻СÐÄ°Ñ·µ»ØµÄ½á¹û×÷ΪÊý×éµÄË÷ÒýȥȡֵµÄ»°£¬ÄÇôʲô½á¹û¶¼Ã»ÓС£
var a:Number = 28 ......
ÔÌûµØÖ·:
http://coolshell.cn/?p=2235
----------------ÎÒÊÇ×ÏÔ·×îÃȵķָîÏßXD--------------
¸ÅÊö£º
±¾ÎÄÖ÷ÒªÑо¿µÄÊÇJAVAµÄ×Ö·û´®Æ´½ÓµÄÐÔÄÜ£¬ÔÎÄÖеIJâÊÔ´úÂëÔÚ¹¦ÄÜÉϲ¢²»µÈ¼Û£¬µ¼ÖÂconcatµÄ²â
ÊÔÒâÒå²»´ó¡£²»¹ýÔ×÷ÕßÔÚÆÀÂÛÀ¸¸øÁËеÄconcat½á¹û£¬Èç¹ûÓÐÐËȤµÄͬѧ½¨Òé×Ô¼ºÐ޸ĴúÂë²âÊÔ¡£
ÔÎijö´¦:http://ww ......
µ±Á½¸ö½ø³ÌÔÚ½øÐÐÔ¶³ÌͨÐÅʱ£¬±Ë´Ë¿ÉÒÔ·¢Ë͸÷ÖÖÀàÐ͵ÄÊý¾Ý¡£ÎÞÂÛÊǺÎÖÖÀàÐ͵ÄÊý¾Ý£¬¶¼»áÒÔ¶þ½øÖÆÐòÁеÄÐÎʽÔÚÍøÂçÉÏ´«ËÍ¡£·¢ËÍ·½ÐèÒª°ÑÕâ¸öjava¶ÔÏóת»»Îª×Ö½ÚÐòÁУ¬¼´java¶ÔÏóÐòÁкţ¬²ÅÄÜÔÚÍøÂçÉÏ´«ËÍ£»½ÓÊÕ·½ÔòÐèÒª°Ñ×Ö½ÚÐòÁÐÔÙ»Ö¸´ÎªJava¶ÔÏ󣬼´·´ÐòÁл¯¡£
¡¡¡¡°ÑJava¶ÔÏóת»»Îª×Ö½ÚÐòÁеĹý³Ì³ÆΪ¶ÔÏóµÄÐòÁл¯¡£
¡¡ ......
ʹÓÃÀ༯²»½ö¿ÉÒÔ±íʾ³öÒ»¶ÔÒ»µÄ¹Øϵ£¬Ò²¿ÉÒÔ±íʾ³ö¶à¶Ô¶àµÄ¹Øϵ¡£ÀýÈ磬һ¸öѧÉú¿ÉÒÔÑ¡¶àÃſγ̣¬Ò»Ãſγ̿ÉÒÔÓжà¸öѧÉú²Î¼Ó£¬ÄÇôÕâ¾ÍÊÇÒ»¸öµäÐ͵Ķà¶Ô¶à¹Øϵ¡£
ÒªÍê³É±¾³ÌÐò£¬Ê×ÏÈÓ¦¸Ã¶¨ÒåÁ½¸öÀࣺѧÉúÐÅÏ¢ÀàStudent¡¢¿Î³ÌÐÅÏ¢ÀàCourse¡£ÔÚÒ»¸öѧÉúÀàÖдæÔÚÒ»¸ö¼¯ºÏ£¬±£´æÈ«²¿µÄ¿Î³Ì£»¶øÔڿγÌÀàÖ ......