Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SpringÅäÖõÄMS SQLSERVER 2008 JDBCÁ¬½Ó


  ²»µÃ²»ËµµÄÔÚ MS SQL SERVER Ï嵀 JDBC µ÷ÓÃ
 
½ñÌìÏÂÎ磬ÁÙʱ¾ö¶¨ÒªÔÙ MS SQL-SERVER  ÏÂÅäÖà Spring µÄÊý¾ÝÔ´ DataSource ¡£µ«ÅäÖÃÁË°ëÌì,»ñÈ¡Êý¾ÝÔ´ÈÔ²»³É¹¦£¬ÎÒûÓа취£¬ÕÒÔ­Òòߣ¬Ö»ÄÜд¸öÁÐ×Ó²âÊÔÏ¡£ÏȲ»¹ÜÈýÆ߶þʮһ£¬ÏÈÉÏÕýÈ·µÄÀý×ÓÔÙ˵¡£
¿´¿ÍÈç¹ûÏëÔËÐÐÏÂÃæµÄ´úÂ룬ÐèÒª×Ô¼ºÊÖ¹¤Ð´¸öÖ÷º¯Êýµ÷Ó㬻òÕßʹÓà JUnit ×ö¸ö²âÊÔ¡£Èç¹ûÕâ¸öÀý×ÓÔËÐгɹ¦,¾Í˵Ã÷²»ÊÜ»úÆ÷»·¾³Ó°Ï죬ûÓбØÒª¹Ø±Õ·À»ðǽºÍɱ¶¾Èí¼þ¡£
 
Çë×¢Ò⣬ÀïÃæµÄºìÉ«×ÖÌ壬Çë»»³Éʵ¼ÊSQL SERVER ·þÎñÆ÷µØÖ·¡£¡¾ dbc:sqlserver://localhost:1433¡¿
¼´£º
   £¨1)connectionUrl
    (2)String SQL = "SELECT [ID],[USER_ID],[NAME],[EMAIL] from [Z_MARK_MANAGE].[dbo].[USER]";
 ÉÏÃæ2¸öÄã±ØÐëµÃ»»¡£
package com.wellhope.bob;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import com.microsoft.sqlserver.jdbc.SQLServerDriver;
/**
* @author Bob
*
*/
public class GetConn {


/**
* @param args
*/
public void getconn() {
// TODO Auto-generated method stub
// Create a variable for the connection string.
String connectionUrl = "jdbc:sqlserver://localhost:1433;database=Z_MARK_MANAGE;integratedSecurity=false;user=sa;password=wellhope;";

// Declare the JDBC objects.
Connection con = null;
Statement stmt = null;
ResultSet rs = null;

try {
// Establish the connection.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection(connectionUrl);

// Create and execute an SQL statement that returns some data.
String SQL = "SELECT [ID],[USER_ID],[NAME],[EMAIL] from [Z_MARK_MANAGE].[dbo].[USER]";
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);

// Iterate through the data in the result set and display it.
while (rs.next()) {

Sy


Ïà¹ØÎĵµ£º

²»ÖØÆôSQL·þÎñ£¬É¾³ýSQLServerϵͳÈÕÖ¾

    µ±SQLServerµÄϵͳÈÕÖ¾¹ý´ó£¬¾Í»áÒýÆðSQLServer·þÎñÆ÷ÎÞ·¨Æô¶¯µÈһϵÁÐÎÊÌâ¡£½ñÌìÎÒÓöµ½ÁËÕâ¸öÎÊÌ⣬ÔÚÍøÉÏËÑË÷ÁËһϣ¬½â¾ö·½·¨ÊÇɾ³ý¾Í¿ÉÒÔÁË£¬¿ÉÊǵ±Ç°µÄErrorLogÕýÔÚ±»SQLʹÓÃÎÞ·¨É¾³ý°¡£¬ÒªÉ¾³ýÖ»ÄÜÍ£Ö¹SQL·þÎñÆ÷£¬ÄѵÀ¾ÍûÓбðµÃ°ì·¨ÁËÂð£¿
    »Ø´ðÊǿ϶¨µÄ£ºÊ¹ÓÃÒÔÏ´洢¹ý³Ì£º ......

sqlserver¸Ä±äÊÇ·ñÇø·Ö´óСд

²é¿´ÊÇ·ñÇø·Ö´óСд-Ö´Ðд洢¹ý³Ìsys.sp_server_info
exec sys.sp_server_info
²é¿´µÚ18ÐÐCOLLATION_SEQ-collationÊôÐÔ
charset=cp936 collation=Chinese_PRC_CS_AS
csΪÇø·Ö´óСд£¬CIΪ²»Çø·Ö´óСд
½«Çø·Ö´óСд¸ÄΪ²»Çø·Ö´óСд
alter database yourDB COLLATE Chinese_PRC_CI_AS
½«²»Çø·Ö´óСд¸ÄΪÇø·Ö´óСд ......

JavaScriptÁ¬½ÓSqlServer²¢ÊµÏÖ·ÖÒ³(¶þ)

//×ܼǼÊý
function sumRecord()
{
var conn= Server.CreateObject("ADODB.connection");
var rs= Server.CreateObject("adodb.recordset");
conn.open("PROVIDER=SQLOLEDB;DATA SOURCE=127.0.0.1;UID=sa;PWD=123456;DATABASE=test");
var sql = "select count(*) as RecordCount from baoming";
rs.open(sql, ......

SQLSERVER¸½¼Ó´íÎó´úÂë823µÄ´¦Àí


sqlserver¸½¼ÓÊý¾Ý¿â´íÎó823µÄ½â¾ö·½°¸2008-10-13 15:06sqlserver¸½¼ÓÊý¾Ý¿â´íÎó823µÄ½â¾ö·½°¸Ò»¡¢SQL-Server¸½¼ÓÊý¾Ý¿âʱʧ°Ü¡£
1¡¢Òì³£Çé¿ö£º·þÎñÆ÷ÔÚÕý³£ÔËÐеÄÇé¿öÏÂͻȻ¶Ïµç£¬µ¼ÖÂÊý¾Ý¿âÎļþË𻵣¬¾ßÌå±íÏÖÊÇ£ºÊý¾Ý¿âÃûºóÃæÓГ£¨ÖÃÒÉ£©”×ÖÑù¡£
2¡¢Òì³£·ÖÎö£º¹ØÓÚ823´íÎóµÄ SQL-SERVER ÖеİïÖú£º
=== ......

SQLServerµÄÁ½¸öά»¤¼¼ÇÉ

¡¡È·Êµ£¬Êý¾Ý¿âµÄά»¤³£³£½»¸øÄÇЩרҵµÄÊý¾Ý¿â¹ÜÀíÔ±£¬µ«ÊÇ×÷Ϊһ¸ö¿ª·¢Õߣ¬ÄãÒ²Ðíż¶ûÐèÒªÔÝʱ´ÓÊÂÕâ¸ö¹¤×÷¡£ËùÒÔ£¬ÊÔÒ»ÊÔÕâÁ½¸öSQL·þÎñÆ÷ά»¤¼¼ÇÉ£ºÇáËɸıäÊý¾Ý¿âÓµÓÐÕß¡¢ÕûÀíË÷ÒýËéƬ¡£Ë­»áÏëµ½ÄãÉõÖÁ¿ÉÒÔ¸øÄÇЩÊý¾Ý¿â¹ÜÀíÔ±½ÌÉÏÒ»Á½¸öм¼ÇÉÄØ£¿ÖØÖ¸¶¨Êý¾Ý¿âÓµÓÐÕßµ±»Ø¸´»òÕßн¨Êý¾Ý¿âʱ£¬ÄãÓÐûÓÐ×¢Òâµ½SQL Server° ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ