JavaÁ¬½ÓSQL Server 2000
Êý¾Ý¿â²Ù×÷ÏÖÔÚÊÇÏîÄ¿¿ª·¢µÄ¸ù±¾£¬Ñ§Ï°JavaÊ×ÏÈÓ¦¸Ãѧ»áÔõôÑùÁ¬½ÓÊý¾Ý¿â£¬ÓÃJavaÁ¬½ÓÊý¾Ý¿â¿É²»ÏñÓÃDelphiÕâÀ๤¾ßÄÇÑùÉ輸¸öÊôÐÔ¾ÍOK£¬Ëµ¼òµ¥Ò²¼òµ¥£¬Ëµ¸´ÔÓ£¬ÆäʵҲͦ¸´Ôӵģ¬¶øÇÒºÜÂé·³£¬Èç¹ûÊdzõѧ£¬¸ù±¾²»Äܱ£Ö¤µÚÒ»´Î¾ÍÁ¬½Ó³É¹¦£¬ÏÂÃæÒÔSQL Server 2000ΪÀý£¬ËµËµJavaÁ¬½ÓÊý¾Ý¿âµÄ»ù±¾·½·¨£¬Ò²¼Ç¼һÏÂÐĵá£
1¡¢ÏÂÔØSQL Server 2000 driver for JDBC
SQL Server 2000 Driver For JDBC Downloads
¸ÃÇý¶¯½ØֹĿǰÓÐËĸö°æ±¾£¬½¨ÒéÏÂÔØ×îеÄSP3°æ¡£
¸ÃÇý¶¯°²×°³É¹¦ºó£¬Ç뽫°²×°Ä¿Â¼ÏµÄlibĿ¼ÏµÄÈý¸ö.jarÎļþ¼Óµ½CLASSPATHÖУ»Èç¹ûÄãʹÓõÄÊÇJBuilder»òEclipse£¬½«ÕâÈý¸öÎļþ¸ù¾ÝIDEµÄÌáʾ¼Óµ½¹¤³ÌÖÐÒ²¿É¡£
2¡¢Éý¼¶ÄãµÄSQL Server 2000£¬ÎªÆä´òÉÏ×îеIJ¹¶¡¡£
ÕâÒ»²½¿ÉÄܲ»ÊDZØÐèµÄ£¬Òò²Ù×÷ϵͳ»·¾³¶ø¶¨£¬ÔÚ²»´ò²¹¶¡µÄÇé¿ö£¬ÓÐʱ¿ÉÒÔÕý³£Á¬½Ó£¬ÓÐʱȴ²»ÄÜ£¬ËùÒÔ½¨Ò黹ÊÇ°²×°×îеÄSQL Server 2000²¹¶¡£¨SP4£©ºÍJDBCÇý¶¯£¨SP3£©¡£
Èç¹ûÄãµÄ³ÌÐòÔÚÔËÐÐʱÌáʾ£ºError establishing socket£¬Ò»°ãÇé¿öÏ£¬´òÉÏSQL Server 2000µÄ²¹¶¡¾Í¿É½â¾ö¡£
3¡¢Çý¶¯µÄ¼ÓÔØ·½·¨
ÔÚ½¨Á¢Á¬½Ó֮ǰ£¬ÒªÏȼÓÔØSQL Server 2000 JDBCµÄÇý¶¯£¬´úÂëÐÎʽÈçÏ£º
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
ÔÚ´Ë×¢Ò⣬forName·½·¨µÄ²ÎÊý×Ö·û´®±ØÐëÍêÈ«ÏàͬÓÚÒÔÉÏÄÚÈÝ£¬´óСдÊÇÇø·ÖµÄ£¬ÆäʵÕâ¸ö´®¾ÍÊÇÇý¶¯ÀàµÄÍêÕûÃû³Æ£º°üÃû+ÀàÃû¡£
4¡¢»ñµÃÒ»¸öÁ¬½Ó
ÔÚ²Ù×÷Êý¾Ý¿â֮ǰ£¬ÒªÏÈ»ñµÃÓëÊý¾Ý¿âµÄÒ»¸öÁ¬½Ó£¬Ê¹ÓÃÈçÏ´úÂë¸ñʽ£º
DriverManager.getConnection(Á¬½Ó×Ö·û´®, µÇ¼Óû§Ãû, µÇ¼ÃÜÂë);
Àý£º
DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=pubs", "sa", "");
ÔÚ´Ë´¦¹Ø¼üµÄÊÇÁ¬½Ó×Ö·û´®µÄÄÚÈÝ£¬localhost²¿·Ö¼´·þÎñÆ÷µÄÃû×Ö£¬¿ÉÒÔ¸ü¸Ä£»1433²¿·ÖΪSQL ServerʹÓõĶ˿ںţ¬¸ù¾Ýʵ¼ÊÇé¿öÐ޸ļ´¿É£»DatabaseName¼´ÎªÒªÁ¬½ÓµÄÊý¾Ý¿âµÄÃû×Ö£¬ÔÚ´Ë×¢ÒâDatabaseName֮ǰµÄÊǷֺţ¬¶ø²»ÊÇðºÅ¡£
5¡¢´úÂëʵÀý
// µ¼ÈëJava SQL°ü£¬Á¬½ÓÊý¾Ý¿â±ØÐ裻
import java.sql.*;
public class TestDB {
public static void main(String[] args) {
String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String dbURL = "jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=pubs";
String userName = "sa";
String userPwd = "";
Connection dbCo
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
ÃæÏò¶ÔÏóµÄ˼Ïë
anything is Object£¨ÍòÎï½Ô¶ÔÏó£©
³éÏ󣬴ӶԾßÌåµÄ¶ÔÏóÖгéÈ¡ÓÐÓÃÐÅÏ¢¡£
¶ÔÏóÓÐÆä¹ÌÓÐÊôÐÔ£¬¶ÔÏóµÄ·½·¨£¬¼´¶ÔÏóµÄÐÐΪ£¨¶ÔÏóÄÜ×öʲô£©
¶ÔÏó±¾ÉíÊǼòµ¥µÄ£¨¹¦Äܼòµ¥£©£¬¶à¸ö¶ÔÏó¿ÉÒÔ×é³É¸´ÔÓµÄϵͳ£¨¶ÔÏóÖ®¼ä±Ë´Ëµ÷ÓöԷ½µÄ·½·¨£©
¶ÔÏóÓ¦µ±ÊǸ÷˾ÆäÖ°£¨¹¦Äܼòµ¥£©£¬¸÷¾¡ËùÄÜ£¨°Ñ×Ô¼ºµÄ¹¦ÄÜ×÷µ½×îºÃ£© ......
Ò»¸öÓÅÐãµÄjava±à³Ì³ÌÐòÔ±±ØÐëÁ˽âGCµÄ¹¤×÷ÔÀí¡¢ÈçºÎÓÅ»¯GCµÄÐÔÄÜ¡¢ÈçºÎÓëGC½øÐÐÓÐÏ޵Ľ»»¥£¬ÒòΪÓÐһЩӦÓóÌÐò¶ÔÐÔÄÜÒªÇó½Ï¸ß£¬ÀýÈçǶÈëʽϵͳ¡¢ÊµÊ±ÏµÍ³µÈ£¬Ö»ÓÐÈ«ÃæÌáÉýÄÚ´æµÄ¹ÜÀíЧÂÊ £¬²ÅÄÜÌá¸ßÕû¸öÓ¦ÓóÌÐòµÄÐÔÄÜ¡£±¾ÆªÎÄÕÂÊ×Ïȼòµ¥½éÉÜGCµÄ¹¤×÷ÔÀíÖ®ºó£¬È»ºóÔÙ¶ÔGCµÄ¼¸¸ö¹Ø¼üÎÊÌâ½øÐÐÉîÈë̽ÌÖ£¬×îºóÌá³öһЩjava± ......