ÈçºÎÁ¬½ÓSQL ServerÊý¾Ý¿â£¨Java°æ£©
ÓÃJavaÁ¬½ÓSQL Server2000Êý¾Ý¿âÓжàÖÖ·½·¨£¬ÏÂÃæ½éÉÜÆäÖÐ×î³£ÓõÄÁ½ÖÖ£¨Í¨¹ýJDBCÇý¶¯Á¬½ÓÊý¾Ý¿â£©¡£
1. ͨ¹ýMicrosoftµÄJDBCÇý¶¯Á¬½Ó¡£´ËJDBCÇý¶¯¹²ÓÐÈý¸öÎļþ£¬·Ö±ðÊÇmssqlserver.jar¡¢msutil.jarºÍmsbase.jar£¬¿ÉÒÔµ½Î¢ÈíµÄÍøվȥÏÂÔØ£¨http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B138-2AA54BFDC03A&displaylang=en£©£¬Èç¹ûÄãÏÂÔصÄÊÇsetup.exe£¬»¹ÐèÒª°²×°Ëü£¬°²×°ºó»áÉú³ÉÉÏÃæµÄÈý¸öjarÎļþ¡£´ËJDBCÇý¶¯ÊµÏÖÁË JDBC 2.0¡£
Çý¶¯³ÌÐòÃû³Æ£ºcom.microsoft.jdbc.sqlserver.SQLServerDriver£¨¼´ÏÂÃæµÄclassforname£©
Êý¾Ý¿âÁ¬½ÓURL£ºjdbc:microsoft:sqlserver://localhost:1433;DatabaseName=dbname£¨¼´ÏÂÃæµÄurl£©
2. ͨ¹ýJTDS JDBC DriverÁ¬½ÓSQL ServerÊý¾Ý¿â£¬´ËÇý¶¯µÄÎļþÃûΪjtds-1.2.jar£¬ÏÂÔØ·¾¶Îª£¨http://sourceforge.net/project/showfiles.php?group_id=33291£©£¬´ËÇý¶¯Ö§³ÖMicrosoft SQL Server (6.5, 7.0, 2000 ºÍ2005) ºÍSybase£¬²¢ÇÒʵÏÖÁËJDBC3.0£¬ÊÇÃâ·ÑµÄ¡£
Çý¶¯³ÌÐòÃû³Æ£ºnet.sourceforge.jtds.jdbc.Driver£¨¼´ÏÂÃæµÄclassforname£©
Êý¾Ý¿âÁ¬½ÓURL£ºjdbc:jtds:sqlserver://localhost:1433/dbname£¨¼´ÏÂÃæµÄurl£©
JDBCÁ¬½ÓSQL ServerÊý¾Ý¿âµÄBean´úÂëÍøÉÏ´ó°ÑµÄÓУ¬ÏÂÃæժ¼ÆäÖеÄÒ»²¿·Ö£º£¨Ç뽫localhostºÍ1433¸Ä³ÉÄãʵ¼ÊÓ¦ÓÃÖеÄSQL Server·þÎñÆ÷µØÖ·ºÍ¶Ë¿ÚºÅ£¬dbname¸Ä³ÉÄãʵ¼ÊµÄÊý¾Ý¿âÃû£©
import java.sql.*;
public class DatabaseConn {
private Connection conn;
private Statement stmt;
private String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=dbname";
private String classforname = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
private String uid = "sa";
private String pwd = "password";
public DatabaseConn(){}
/**
* <p>ͨ¹ýMicrosoft JDBCÇý¶¯»ñµÃÊý¾Ý¿âÁ¬½Ó</p>
* @return Connection
* @exception ClassNotFoundException, SQLException
*/
public Connection getConnection()
{
try
{
Class.forName(classforname);
if (conn == null || conn.isClosed())
conn = DriverMana
Ïà¹ØÎĵµ£º
SQL Server .NET Data Provider Á¬½Ó×Ö·û´®°üº¬Ò»¸öÓÉһЩÊôÐÔÃû/Öµ¶Ô×é³ÉµÄ¼¯ºÏ¡£Ã¿Ò»¸öÊôÐÔ/Öµ¶Ô¶¼ÓɷֺŸô¿ª¡£
PropertyName1=Value1;PropertyName2=Value2;PropertyName3=Value3;.....
ͬÑù£¬Á¬½Ó×Ö·û´®±ØÐë°üº¬SQL ServerʵÀýÃû³Æ:
  ......
Ò» µ¥´Ê½âÊÍ(2·Ö/¸ö) 34·Ö
¡¡¡¡Data Êý¾Ý Database Êý¾Ý¿â RDBMS ¹ØϵÊý¾Ý¿â¹ÜÀíϵͳ GRANT ÊÚȨ
¡¡¡¡REVOKE È¡ÏûȨÏÞ DENY ¾Ü¾øȨÏÞ DECLARE ¶¨Òå±äÁ¿ PROCEDURE´æ´¢¹ý³Ì
¡¡¡¡ÊÂÎñ Transaction ´¥·¢Æ÷ TRIGGER ¼ÌÐø continue Ψһ unqiue
¡¡¡¡Ö÷¼ü primary key ±êʶÁÐ identity Íâ¼ü foreign key ¼ì ......
Èç¹ûÏë²éÕÒ“_cs”½áβµÄµÄÕË»§
select * from [user] where loginname like '%_cs'ÊDz»Ðеģ¬_ ±»ÈÏΪÊÇÈÎÒâµÄ×Ö·û£¬
ËùÒÔÐèҪתÒå×Ö·û£¬ÓÐÁ½ÖÖд·¨£º
select * from [user] where loginname like '%[_]cs'
select * from [user] where loginname like '%/_cs' escape'/'
ͨÅä·ûº¬Òå
%
°üº¬Áã¸ö»ò¸ü¶à×Ö· ......
1.¼¯ºÏ²Ù×÷
ѧϰoracle
Öм¯ºÏ²Ù×÷µÄÓйØÓï¾ä£¬
ÕÆÎÕunion,union
all,minus,interestµÄʹÓÃ,Äܹ»ÃèÊö½áºÏÔËË㣬²¢ÇÒÄܹ»½«¶à¸ö²éѯ×éºÏµ½Ò»¸ö²éѯÖÐÈ¥£¬Äܹ»¿ØÖÆÐзµ»ØµÄ˳Ðò¡£
°üº¬¼¯ºÏÔËËãµÄ
²éѯ³ÆΪ¸´ºÏ²éѯ¡£¼û±í¸ñ1-1
±í1-1
Operator Returns &nb ......
RepeaterÔÚǰ̨ʹÓñȽÏÁé»î×ÔÓÉ£¬µ«ÓÐÒ»¸öÎÊÌâ¾ÍÊÇRepeater²»Ö§³ÖÖ±½Ó·ÖÒ³£¬Õâ¸öºÜ¶àÈË¿´ÆðÀ´¾ÍÓе㲻ÏëÓÃÁË£¬µ«ÎÒÏë´ó¼Ò¶¼ÖªµÀGridView¿Ø¼þ»òDataGrid¿Ø¼þÔÚÆôÓÃ×Ô´ø·ÖÒ³µÄʱºòÆäʵЧÂÊÊǷdz£µÍµÄ£¬´óµÄ²»Ëµ£¬Ò»µ«µ½ÁË°ÙÍò¼¶Êý¾ÝÒԺ󣬾ͻá¸Ð¾õÊǶàôµÄÍ´¿àºÍÎÞÄÍÁË£¬ËùÒÔ¼´Ê¹ÊÇÓÃDataGrid(GridView)¿Ø¼þ£¬¸ßÊÖÃÇ»¹ÊÇÖ»»á ......