锘??xml version="1.0" encoding="utf-8" standalone="yes"?> public static List<String> executeQuery(String sql,String columns) { try { public static Connection getConnection() {
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2.4</version>
</dependency>
Connection conn = getConnection();
Statement st = conn.createStatement();
ResultSet set = st.executeQuery(sql);
List<String> result = new ArrayList<String>();
while (set.next()) {
String[] columnList = columns.split(",");
for(String str:columnList){
result.add(set.getString(str));
}
}
set.close();
st.close();
conn.close();
return result;
} catch (SQLException e) {
throw new IllegalArgumentException(e);
}
}
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
String url = "jdbc:jtds:sqlserver://localhost:1433;DatabaseName=jdl";
String username = "sa";
String password = "";
Connection conn = DriverManager.getConnection(url, username,
password);
return conn;
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
]]>
shrxm= java.net.URLDecoder.decode(shrxm,"UTF-8");
]]>
http://downloads.mongodb.org/win32/mongodb-win32-i386-2.0.4.zip
2)銆佽緗?span lang="EN-US">MongoDB鐩綍
灝嗗叾瑙e帇鍒?span lang="EN-US"> d:\錛屽啀閲嶅懡鍚嶄負mongodb錛岃礬寰勪負d:\mongodb
3)銆佽緗暟鎹枃浠惰礬寰?/span>
鍦?span lang="EN-US">d:鐩樺緩涓涓?span lang="EN-US">data鏂囦歡澶癸紝鍦?span lang="EN-US">data鏂囦歡澶逛腑鏂板緩db鏂囦歡澶癸紝璺緞d:\data\db
4)銆佸惎鍔?span lang="EN-US">MongoDB鏈嶅姟
榪涘叆 cmd 鎻愮ず絎︽帶鍒跺彴錛?span lang="EN-US">
D:\mongodb\bin\mongod.exe --dbpath=d:\data\db
<!--[if !supportLists]-->1. <!--[endif]-->Mon Apr 16 08:50:54
<!--[if !supportLists]-->2. <!--[endif]-->Mon Apr 16 08:50:54 warning: 32-bit servers don't have journaling enabled by def
<!--[if !supportLists]-->3. <!--[endif]-->ault. Please use --journal if you want durability.
<!--[if !supportLists]-->4. <!--[endif]-->Mon Apr 16 08:50:54
<!--[if !supportLists]-->5. <!--[endif]-->Mon Apr 16 08:50:54 [initandlisten] MongoDB starting : pid=5084 port=27017 dbpat
<!--[if !supportLists]-->6. <!--[endif]-->h=d:\data\db 32-bit host=PC-201012302214
<!--[if !supportLists]-->7. <!--[endif]-->Mon Apr 16 08:50:54 [initandlisten]
<!--[if !supportLists]-->8. <!--[endif]-->Mon Apr 16 08:50:54 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are
<!--[if !supportLists]-->9. <!--[endif]-->limited to about 2 gigabytes of data
<!--[if !supportLists]-->10. <!--[endif]-->Mon Apr 16 08:50:54 [initandlisten] ** see http://blog.mongodb.org/post/13
<!--[if !supportLists]-->11. <!--[endif]-->7788967/32-bit-limitations
<!--[if !supportLists]-->12. <!--[endif]-->Mon Apr 16 08:50:54 [initandlisten] ** with --journal, the limit is lower
<!--[if !supportLists]-->13. <!--[endif]-->Mon Apr 16 08:50:54 [initandlisten]
<!--[if !supportLists]-->14. <!--[endif]-->Mon Apr 16 08:50:54 [initandlisten] db version v2.0.4, pdfile version 4.5
<!--[if !supportLists]-->15. <!--[endif]-->Mon Apr 16 08:50:54 [initandlisten] git version: 329f3c47fe8136c03392c8f0e548506
<!--[if !supportLists]-->16. <!--[endif]-->cb21f8ebf
<!--[if !supportLists]-->17. <!--[endif]-->Mon Apr 16 08:50:54 [initandlisten] build info: windows sys.getwindowsversion(ma
<!--[if !supportLists]-->18. <!--[endif]-->jor=6, minor=0, build=6002, platform=2, service_pack='Service Pack 2') BOOST_LIB
<!--[if !supportLists]-->19. <!--[endif]-->_VERSION=1_42
<!--[if !supportLists]-->20. <!--[endif]-->Mon Apr 16 08:50:54 [initandlisten] options: { dbpath: "d:\data\db" }
<!--[if !supportLists]-->21. <!--[endif]-->Mon Apr 16 08:50:54 [websvr] admin web console waiting for connections on port 2
<!--[if !supportLists]-->22. <!--[endif]-->8017
<!--[if !supportLists]-->23. <!--[endif]-->Mon Apr 16 08:50:54 [initandlisten] waiting for connections on port 27017
MongoDB鏈嶅姟绔殑榛樿榪炴帴绔彛:27017
5)銆佸皢MongoDB浣滀負 Windows 鏈嶅姟闅忔満鍚姩
鍏堝垱寤?span lang="EN-US">D:\mongodb\logs\mongodb.log鏂囦歡錛岀敤浜庡瓨鍌?span lang="EN-US">MongoDB鐨勬棩蹇楁枃浠?span lang="EN-US">, 鍐嶅畨瑁呯郴緇熸湇鍔★細
D:\mongodb\bin\mongod --dbpath=d:\data\db --logpath=d:\mongodb\log
s\mongodb.log --install
all output going to: d:\mongodb\logs\mongodb.log
Creating service MongoDB.
Service creation successful.
Service can be started from the command line via 'net start "MongoDB"'.
D:\>net start mongodb
Mongo DB 鏈嶅姟宸茬粡鍚姩鎴愬姛銆?/span>
D:>
娉ㄦ剰錛氬鏋滈渶瑕佸嵏杞芥湇鍔★紝鎵ц鍛戒護錛?/span>sc delete MongoDB
6)銆佸鎴風榪炴帴楠岃瘉
鏂版墦寮涓涓?span lang="EN-US">CMD杈撳叆錛?span lang="EN-US">d:\mongodb\bin\mongo錛屽鏋滃嚭鐜頒笅闈㈡彁紺猴紝閭d箞鎮ㄥ氨鍙互寮濮?span lang="EN-US">MongoDB涔嬫梾浜嗭細
<!--[if !supportLists]-->1. <!--[endif]-->d:\mongodb\bin\mongo
<!--[if !supportLists]-->2. <!--[endif]-->MongoDB shell version: 2.0.4
<!--[if !supportLists]-->3. <!--[endif]-->connecting to: test
<!--[if !supportLists]-->4. <!--[endif]-->>
7)銆佹煡鐪?span lang="EN-US">MongoDB鏃ュ織
鏌ョ湅D:\mongodb\logs\mongodb.log鏂囦歡錛屽嵆鍙MongoDB鐨勮繍琛屾儏鍐佃繘琛屾煡鐪嬫垨鎺掗敊銆?/span>