ÅäÖÃSQL Server2005 expressÓëjdbcÁ¬½Ó
ÉÏ΢ÈíÍøÕ¾ÏÂÔØsqlserver2005 jdbc driver °ü
1¡¢½«microsoft sql server 2005 jdbc driver\sqljdbc_1.2\chs\sqljdbc.jar°ü copyµ½·¢²¼ÏµÍ³ µÄ web-inf\libĿ¼ÖÐ
2¡¢½«microsoft sql server 2005 jdbc driver\sqljdbc_1.2\chs\auth\x86\sqljdbc_auth.dll Îļþcopyµ½ windows\system32Ŀ¼
web-inf\fcconfig.xml ÎļþÖеÄÁ¬½Ó×Ö·û´®ÈçÏÂÉèÖÃ
<ds name="fhjtest" dbtype="sqlserver"
type="jdbc" jdbcdriver="com.microsoft.sqlserver.jdbc.sqlserverdriver" jdbcurl="jdbc:sqlserver://localhost:1433;databasename=wy;integratedsecurity=true;" user="sa" password="small" />
×¢ÖØ£º
jdbcdriver="com.microsoft.sqlserver.jdbc.sqlserverdriver"
jdbcurl="jdbc:sqlserver://localhost:1433;databasename=wy;integratedsecurity=true;"
ÅäÖÃSQL Server2005 expressÓëjdbcÁ¬½Ó
±¾ÎÄÖ÷Òª½éÉÜÁËÅäÖÃSQL Server2005 expressÓëjdbcÁ¬½ÓµÄÈ«¹ý³Ì¡£
SQL Server2000ϵÄJavaÓ¦ÓÃÄÜ·ñÔÚSQL Server 2005 expressÉÏÔËÐУ¬¾¹ý²»¶Ï²âÊÔÓëÅäÖã¬×ܽáÒÔϾÑ飺
1£ºÊ×ÏÈÈ·ÈÏSQL Server2005 expressÒѾ°²×°ºÃÁË¡£
2£ºÆôÓÃTCP/IPÐÒé¡£
ÔÚ“³ÌÐò->Microsoft SQL Server 2005->ÅäÖù¤¾ß->SQL Server ÍâΧӦÓÃÅäÖÃÆ÷”Öдò¿ªTCP/IPÐÒé¡£ÈçÏ£º
ͼ1-1 SQL Server ÍâΧӦÓÃÅäÖÃÆ÷´°¿Ú
Ñ¡Ôñ“·þÎñºÍÁ¬½ÓµÄÍâΧӦÓÃÅäÖÃÆ÷”£¬ÈçÏ£º
ÔÚ“Ô¶³ÌÁ¬½Ó”ÖÐÑ¡Ôñ“ͬʱʹÓÃTCP/IPºÍnamed pipes£¨B£©”,È»ºóµã“Ó¦ÓÔ¡£
3£ºÅäÖÃSQL Server 2005ÖеÄTCP/IPÐÒé
ÔÚ“³ÌÐò->Microsoft SQL Server 2005->ÅäÖù¤¾ß”ÏÂÔËÐГSQL Server Configuration Manager”£¬ÈçÏ£º
ĬÈÏTCP/IPÊôÐÔ,È«²¿ÕìÌýµÄֵΪ“ÊÇ”£¬ÈçÏ£º
ÐÞ¸ÄTCP/IPÊôÐÔ,½«È«²¿ÕìÌý¸ÄΪ“·ñ”
½«TCP¶¯Ì¬¶Ë¿Ú¸ÄΪ¿Õ£¨È÷þÎñÆ÷×Ô¼ºÑ¡Ôñ¶Ë¿Ú£©, TCP¶Ë¿Ú¸ÄΪ1433
ÍƼö£ºÈ»ºóÖØÆô»úÆ÷£¬ÈÃÖØÆô»úÆ÷µÄ¹ý³ÌÖаÑSQL Server 2005 expressÆô¶¯¡£Ò²¿ÉÒÔÖØÐÂÆô¶¯SQL Server2005 express·þÎñ¡£
4£ºÔÚtomcatÖÐÅäÖÃSQL ServerÊý¾Ý¿â³É¹¦¡£
SQL Server 2005 expressÖÐurlºÍdriverClassName¸úSQL Server 2000Óв
Ïà¹ØÎĵµ£º
1). ÉèÖõ±Ç°sessionÊÇ·ñ¶ÔÐ޸ĵÄÊý¾Ý½øÐÐ×Ô¶¯Ìá½» :SET AUTO[COMMIT] {ON|OFF|IMM[EDIATE]| n}
SQL> set autocommit off
2)£®ÔÚÓÃstartÃüÁîÖ´ÐÐÒ»¸ösql½Å±¾Ê±£¬ÊÇ·ñÏÔʾ½Å±¾ÖÐÕýÔÚÖ´ÐеÄSQLÓï¾ä :SET ECHO {ON|OFF}
SQL> set echo on
3).ÊÇ·ñÏÔʾµ±Ç°sqlÓï¾ä²éѯ»òÐ޸ĵÄÐÐÊý
SQL> SET FEED[BACK] {6|n|O ......
SELECT * from xcmis.temp_odr_prom@linkxceis where trim(ODR_NO) like 'CA10010082'
SELECT * from xcmis.temp_odr_prom@linkxceis where ODR_NO like 'CA10010082%'
SELECT * from xcmis.temp_odr_prom@linkxceis where ODR_NO = 'CA10010082'
OK
SELECT * from xcmis.temp_odr_prom@linkxceis where ODR_NO like 'C ......
±¾ÖܺÍÉÏÖܾÀí¸øÎÒÃÇ×öÁËÁ½´Î¹ØÓÚsqlµÄÅàѵ£¬¸Ð¾õºÜÓÐÓÃËùÒÔ×ܽáһϣ¡
Union£ºÖ»ÓÐÁ½Õűí½á¹¹ÏàͬµÄ½á¹û¼¯²ÅÄÜʹÓÃunion£¬½«ËùÓеıíÊý¾Ý·Åµ½Ò»¸ö½á¹û¼¯ÖС£
Count£º¼ÆËã²ÎÊýÁбíÖеÄÊý×ÖÏîµÄ¸öÊý¡£À¨ºÅÀï±ß¿ÉÒÔÊÇÁÐÃû£¬Ò²¿ÉÒÔÊDzÎÊýÖµ¡£
  ......
SQL Server 2005ÆôÓÃsaÕ˺Å
ÆôÓÃsaÓû§ºÍÔ¶³ÌÁ¬½Ó
²Ëµ¥Start->Microsoft SQL Server 2005->Configuration Tools->SQL Server Configuration Manager
Ñ¡ÖÐSQL Server 2005 Network Configuration
ÔÚÓұߵÄTCP/IPÉϵãÓÒ¼ü£¬enabled
²Ëµ¥Start->Microsoft SQL Server 2005->SQL ......