??xml version="1.0" encoding="utf-8" standalone="yes"?>快乐12开奖结果查询:BlogJava - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/supercrsky/专注于JavaWeb开?/description>zh-cnTue, 16 Oct 2018 04:11:45 GMTTue, 16 Oct 2018 04:11:45 GMT60Linux上安装JDK1.7与Tomcat7.0 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/supercrsky/archive/2012/12/11/392821.html々上善若水?/dc:creator>々上善若水?/author>Tue, 11 Dec 2012 08:54:00 GMT//www.ot7t.com.cn/supercrsky/archive/2012/12/11/392821.html//www.ot7t.com.cn/supercrsky/comments/392821.html//www.ot7t.com.cn/supercrsky/archive/2012/12/11/392821.html#Feedback0//www.ot7t.com.cn/supercrsky/comments/commentRss/392821.html//www.ot7t.com.cn/supercrsky/services/trackbacks/392821.htmlUbuntu上安?/span>JDK1.7请用tar.gz包,Fedora可选用rpm包?/span>

如果?/span>Ubuntu?/span>rpm包安装,需要先转换?/span>deb格式?/span>

安装包的下载

jdk7

//www.oracle.com/technetwork/java/javase/downloads/jdk7u9-downloads-1859576.html

tomcat7

//tomcat.apache.org/download-70.cgi

 

Jdk的安?/span>

1.解压或安?/span>

.gz?/span>

#tar -zxvf jdk-7u9-linux-i586.tar.gz

解压后的目录如:jdk1.7.0_09

将其复制或移动到/usr目录?/span>

#mv jdk1.7.0_09 /usr

 

.rpm?/span>

#rpm -ivh jdk-7u9-linux-i586.rpm

 

2.配置环境变量

#vi /etc/profile

?/span>profile文件?/span> umask 022 结束字符前加?/span>

export JAVA_HOME=/usr/jdk1.7.0_09

export JAVA_BIN=/usr/jdk1.7.0_09/bin

export PATH=$PATH:$JAVA_HOME/bin

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

 

 

如果Ubuntu系统还要修改默认jdk

update-alternatives --install /usr/bin/java java /usr/jdk1.7.0_09/bin/java 300

update-alternatives --install /usr/bin/javac javac /usr/jdk1.7.0_09/bin/javac 300

通过这一步将我们安装?/span>jdk加入java选单?/span>

update-alternatives --config java

 

 

重启Terminal测试

#java -version

 

Tomcat的安?/span>

 

1.首先解压?/span>    

#tar -zxvf apache-tomcat-7.0.32.tar.gz

得到Tomcat的所有文?/span>.然后把它拷贝到你要安装的位置,如/opt/tomcat

#cp -r /home/zdw/software/apache-tomcat-7.0.32 /opt/tomcat

切换?/span>/opt/tomcat/bin

#cd /opt/tomcat/bin

运行命令

#./startup.sh

 

正常情况下可以见到如下的信息?/span>    

 

Using CATALINA_BASE:   /opt/tomcat

Using CATALINA_HOME:   /opt/tomcat

Using CATALINA_TMPDIR: /opt/tomcat/temp

Using JRE_HOME:        /usr/java/jdk1.7.0_09

Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar

 

2.然后用浏览器打开如下的网?/span>   

//localhost:8080/    (如果没有把Port number改为80?/span>

如果你见?/span>Tomcat的网页(index.jsp),证明Tomcat安装成功,并已经启动?/span>

 如要关闭Tomcat,在/opt/tomcat/bin下运行下面的命令即可    

#./shutdown.sh



]]>
navicat_for_mysql_10.0.11在linux下的安装 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/supercrsky/articles/392820.html々上善若水?/dc:creator>々上善若水?/author>Tue, 11 Dec 2012 08:39:00 GMT//www.ot7t.com.cn/supercrsky/articles/392820.html//www.ot7t.com.cn/supercrsky/comments/392820.html//www.ot7t.com.cn/supercrsky/articles/392820.html#Feedback0//www.ot7t.com.cn/supercrsky/comments/commentRss/392820.html//www.ot7t.com.cn/supercrsky/services/trackbacks/392820.html官方下载地址?/span>//www.navicat.com/cn/download/download.html

navicat_for_mysql_10.0.11_cn_linux.tar.gz

使用方法?/span>

1.打开终端:应用程?/span>->系统工具(或附件?/span>->终端,切换到root账户?/span>

#su -

密码?/span>

(注意:输入root账户密码时,密码不会显示出来,也没有提示的特殊字符,直接输完密码?/span>Enter键就行了?/span>

 

2.切换到放置下载得到的 navicat_for_mysql_10.0.11_cn_linux.tar.gz 软件包的目录?/span>

例如我把软件包放置到?/span> /home/zdw/software 目录?/span>

# cd /home/zdw/software

3.解压 navicat_for_mysql_10.0.11_cn_linux.tar.gz

# tar -zxvf navicat_for_mysql_10.0.11_cn_linux.tar.gz

解压后会得到名为 navicat_for_mysql 的文件夹

4.将解压生成文件夹移动?/span>/opt目录下:

# mv /home/zdw/software/navicat_for_mysql /opt

 

5.运行 Navicat 方法?/span>

进入安装目录?/span>

# cd /opt/navicat_for_mysql

执行命令?/span>

 

# ./start_navicat

这样即可启动Navicat

 

为了方便,也可以创建Navicat的桌面启动器,方法如下:

在桌面点击右?/span>->点击[创建启动?/span>]?/span>->

【类型】栏选择[应用程序]

【名称】栏填入?/span>Navicat

【命令】栏点击右边的【浏览】选择?/span>->[文件系统]->[opt]->[navicat_for_mysql]->[start_navicat]

最后点击【确定】,就在桌面创建?/span>Navicat的启动器

 

6.破解?/span>

注册?/span> NAVN-LNXG-XHHX-5NOO

用户和组织随便填

 

7.连接上数据库后里面的中文数据若是乱码,把字符集修改?/span>zh_CN.utf8就行?/span>,修改方法:

查看系统支持的字符集

# locale -a

修改字符?/span>

# export LANG=zh_CN.utf8



]]>
mysql5.5.28在Linux下的安装 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/supercrsky/articles/392801.html々上善若水?/dc:creator>々上善若水?/author>Tue, 11 Dec 2012 06:39:00 GMT//www.ot7t.com.cn/supercrsky/articles/392801.html//www.ot7t.com.cn/supercrsky/comments/392801.html//www.ot7t.com.cn/supercrsky/articles/392801.html#Feedback0//www.ot7t.com.cn/supercrsky/comments/commentRss/392801.html//www.ot7t.com.cn/supercrsky/services/trackbacks/392801.html1.       下载mysql

?/span>//dev.mysql.com/downloads/mysql/ 官网上下?/span>mysql-5.5.28-linux2.6-i686.tar.gz.

2.       解压

   假如tar包在/home/zdw/software目录?/span>

#tar -xvf mysql-5.5.28-linux2.6-i686.tar.gz

3.       移动?/span>/usr/local/mysql

#mv mysql-5.5.28-linux2.6-i686 /usr/local/

添加快捷方式mysql指向mysql-5.5.28-linux2.6-i686

#ln -s mysql-5.5.28-linux2.6-i686/ mysql

4.       安装依赖?/span>lib?/span>:执行/usr/local/mysql/bin/mysqld,报错

/usr/local/mysql/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot               open shared object file: No such file or directory

使用apt-cache search libaio,找到如下软件?/span>

libaio-dev - Linux kernel AIO access library - development files

libaio1 - Linux kernel AIO access library - shared library

libaio1-dbg - Linux kernel AIO access library - debugging symbols

使用#apt-get install libaio1 安装

5.       配置用户,目?/span>

#groupadd mysql

#useradd -r -g mysql mysql

#cd /usr/local/mysql

#chown -R mysql .

#chgrp -R mysql .

6.       初始?/span>mysql

    假如当前目录?/span>/usr/local/mysql

#scripts/mysql_install_db --user=mysql

7.       启动mysql

最简单的启动方式:

#/usr/local/mysql/bin/mysqld --user=mysql

默认情况下使?/span>/usr/local/mysql/data作为mysql的数据目录,包括数据库文件,log日志?/span>

常用?/span>mysql启动参数:

/usr/local/mysql/bin/mysqld  --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data  --port=3306 --socket=/tmp/mysql.socks

推荐的启?/span>mysql

#/usr/local/mysql/support-files/mysql.server start

启动完成之后?/span>ps -ef |grep mysql 命令查看是否启动

8.       登录mysql

#/usr/local/mysql/bin/mysql -u root -p

默认密码为空

修改root密码

mysql>use mysql ;
mysql>update user set password=PASSWORD("123456") where user='root';
mysql>FLUSH PRIVILEGES;

9.       关闭mysql

最简单的方式

#killall mysqld

推荐的方?/span>

#/usr/local/mysql/support-files/mysql.server stop

使用mysql.server stop关闭mysqld会销?/span>pid文件,并做容错操作,但是最后也是调?/span>kill命令kill mysql?/span>

 

关闭mysql,尽量不要用kill -9 mysql_pid或者是killall -9 mysql,否则mysql进程无法做退出处理,就可能会丢失数据,甚至导致表损坏?/span>

 

10.   浅析mysql.server脚本的启动流?/span>

mysql.server脚本可以看到在以下脚本调?/span>mysqld_safe这个bash

$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &

默认情况?/span>,$bindir/mysqld_safe就是/usr/local/mysql/bin/mysqld_safe这个shell,我的本机的调用参数如下:

/bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/blue-pc.pid

?/span>mysqld_safe也是一?/span>shell,可以看到在这个脚本在初始?/span>N多变量后,调?/span>

eval_log_error "$cmd"

这个shell function最后就是调?/span>

 #echo "Running mysqld: [$cmd]" eval "$cmd"

在我本机,这?/span>$cmd就是

/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/blue-pc.err --pid-file=/usr/local/mysql/data/blue-pc.pid

参考文章:
//dev.mysql.com/doc/refman/5.5/en/binary-installation.html
本文在Ubuntu11.04和Fedora14下测试成功?/span>



]]>
Apache HttpServer2.2.22与Tomcat6.0整合 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/supercrsky/archive/2012/11/05/390807.html々上善若水?/dc:creator>々上善若水?/author>Mon, 05 Nov 2012 06:24:00 GMT//www.ot7t.com.cn/supercrsky/archive/2012/11/05/390807.html//www.ot7t.com.cn/supercrsky/comments/390807.html//www.ot7t.com.cn/supercrsky/archive/2012/11/05/390807.html#Feedback0//www.ot7t.com.cn/supercrsky/comments/commentRss/390807.html//www.ot7t.com.cn/supercrsky/services/trackbacks/390807.html
1.下载Tomcat,本文用?.0,下载地址://labs.mop.com/apache-mirror/tomcat/tomcat-6/
2.根据系统版本下载相对的Apache HttpServer,本文用的是httpd-2.2.22-win32-x86-openssl-0.9.8t.msi
下载地址://labs.mop.com/apache-mirror/httpd/binaries/win32/
3.下载mod_jk.so,要找到与httd版本对应的,本文用的?span style="line-height: normal; "> tomcat-connectors-1.2.37-windows-i386-httpd-2.2.x.zip?br /> 下载地址?span style="line-height: normal; ">//labs.mop.com/apache-mirror/tomcat/tomcat-connectors/jk/binaries/windows/

安装工作?br /> 1.安装Apache HttpServer,如下图?br />


所有组件全部装上?br /> 安装成功后如下图所示:

在浏览器输入//localhost,如果出?"it works"字样 ,就说明Apache Server安装成功了?br /> 如果安装上后服务没有启动成功,检查你?0端口是否被占用?br /> 2.安装Tomcat,过程我就不细说了,做Java的都会的?br />
配置工作?br /> 1.端口配置
软件我们都装好了,现在需要我们来配置一?br />
打开apache安装目录的:\apache\conf\httpd.conf文件?br />
找到?br /> Listen 80 
关键字,这个就是Apache的监听端口,默认?0,我们也可以根据需要改成其他的?br /> 2.访问目录配置:
找到

ServerName zdw.com:80
其中zdw.com是我们在安装时填写的主机名,这里改成服务器IP?br /> ServerName 192.168.10.104:80 

找到如下这行?/p>

DocumentRoot

你会发下有这样的一行内容:

DocumentRoot "D:/Program Files/apache/htdocs

 

这个叫作DocumentRoot即webroot,即:发布目录,发布在这个目录下的任何工程都会在Apache服务开启时被装载成标准的web工程,我们现在动手来把这个WebRoot定位到我们自己的发布目录中去吧?/p>

DocumentRoot "d:/www"

重启我们的Apache服务,我们用Apache HTTP Server 2.2/Configure Apache Server/Test Configuration来测试一下,如果黑屏一闪而过说明配置正确,否则会显示错误的详细信息?br /> 这时会显?03限制访问的页面?/p>

找到下面这一段:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    deny from all
</Directory>
将deny改成allow即可?br /> 3.静动分离配置
在D:\www目录将你的部署所需的静态文件放到这个目录下,要建一个和tomcat/webapps目录下部署的工程的同名文件夹
,如下图?br />



在httpd.conf里的最后面加上?br />
LoadModule jk_module modules/mod_jk.so
JKWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
<VirtualHost *>
ServerAdmin localhost
DocumentRoot d:/www/
ServerName localhost
DirectoryIndex index.html index.htm index.jsp index.action login.jsp
ErrorLog logs/shsc-error_log.txt
CustomLog logs/shsc-access_log.txt common
JkMount /*WEB-INF ajp13
JkMount /*j_spring_security_check ajp13
JkMount /*.action ajp13
JkMount /servlet/* ajp13
JkMount /*.jsp ajp13
JkMount /*.do ajp13
</VirtualHost> 
这里配置了哪些是需要tomcat来处理的,比如说*.do   ?br /> 连接时的配置参数描述位于Apache安装目录?conf目录下的一个叫workers.properties文件中,mod_jk一般使用ajp13协议连接,使用的是tomcat?009端口 ?br /> workers.properties文件内容如下?br />
workers.tomcat_home=D:/Program Files/Apache Software Foundation/Tomcat 6.0
workers.java_home=D:/Program Files/Java/jdk1.6.0_25
ps=/
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

重启tomcat和apache,就可以通过//localhost/composite 来访问主页了?nbsp;

 

 



]]>
MyEclipse将普通java项目转换成Maven项目 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/supercrsky/articles/387494.html々上善若水?/dc:creator>々上善若水?/author>Tue, 11 Sep 2012 10:37:00 GMT//www.ot7t.com.cn/supercrsky/articles/387494.html//www.ot7t.com.cn/supercrsky/comments/387494.html//www.ot7t.com.cn/supercrsky/articles/387494.html#Feedback1//www.ot7t.com.cn/supercrsky/comments/commentRss/387494.html//www.ot7t.com.cn/supercrsky/services/trackbacks/387494.html
激活Maven后,显示如下?br />
点击完成就后就将普通的java project转换成maven project了?br />这里我们要手动创建src/main/java,src/test/java 目录?br />


到这一步,剩下的操作就和上一回说到的操作一样了。我们先添加Junit依赖,再写一个测试类
就可以进行maven test了?br />


]]>
使用MyEclipse构建MAVEN项目 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/supercrsky/articles/387462.html々上善若水?/dc:creator>々上善若水?/author>Tue, 11 Sep 2012 06:25:00 GMT//www.ot7t.com.cn/supercrsky/articles/387462.html//www.ot7t.com.cn/supercrsky/comments/387462.html//www.ot7t.com.cn/supercrsky/articles/387462.html#Feedback9//www.ot7t.com.cn/supercrsky/comments/commentRss/387462.html//www.ot7t.com.cn/supercrsky/services/trackbacks/387462.html Maven最好配置成你自己安装的那个,MyEclipse自带会有些许Bug?br />

用nexus代理Maven的中央仓库,setting.xml的配置文件修改内容如下:
<mirrors>
     <mirror>
          <id>nexus</id>
          <mirrorOf>*</mirrorOf>
          <name>Nexus Mirror</name>
          <url>//localhost:8081/nexus/content/groups/public</url>
     </mirror>
  </mirrors>
  
  <profiles>
     <profile>
      <id>nexus</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>//central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>//central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
//localhost:8081/nexus/content/groups/public 是仓库组的地址?br /> 打下MyEclipse新建工程的界面,选择Maven下的Maven Project,打开如下图的向导?br />
这里我们要选中create a simple project?br /> 点击下一步,填写GAV相关内容?br />
点击完成后,我们就已经成功创建了一个Maven project了?br /> 工程的默认目录结构如下:


所有的Java源文件都要写在src/main/java目录下,所有的测试类都要写在src/test/java下面,这是Maven的默认值?br />此时,pom.xml里只有默认的属?br />
<project xmlns="//maven.apache.org/POM/4.0.0" xmlns:xsi="//www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="//maven.apache.org/POM/4.0.0 //maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.test</groupId>
  <artifactId>test</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</project>
这是最精简的pom.xml了?br />这时我们加入junit的支持,新建一个测试类?br />在项目上右键Maven-Add Dependency,显示如下界面:

输入junit加入测试支持类库?br />在src/test/java下新建一个测试类如下?br />
package com;
import org.junit.Test;
public class TestRun
{
@Test
public void testA()
{
System.out.println("test a method ");
}
@Test
public void testB()
{
System.out.println("test b method ");
}
}
右键Run As ----- Maven test,进行测试,显示结果如下?br />


[INFO] Scanning for projects
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building test 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ test ---
[debug] execute contextualize
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ test ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ test ---
[debug] execute contextualize
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ test ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ test ---
[INFO] Surefire report directory: D:\workspace\test\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.TestRun
test a method 
test b method 
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.071 sec

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.847s
[INFO] Finished at: Tue Sep 11 14:20:59 CST 2012
[INFO] Final Memory: 3M/6M
[INFO] ------------------------------------------------------------------------
ok,一个基本的maven项目已经构建完成。我们还可以将现存的java项目利用myclipse方便的转换成maven project,此部分内容我们在下一节里讨论?img src ="//www.ot7t.com.cn/supercrsky/aggbug/387462.html" width = "1" height = "1" />

]]>
SQL Server 无法生成 FRunCM 线程。请查看 SQL Server 错误日志?Windows 事件日志 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/supercrsky/articles/384283.html々上善若水?/dc:creator>々上善若水?/author>Mon, 30 Jul 2012 01:37:00 GMT//www.ot7t.com.cn/supercrsky/articles/384283.html//www.ot7t.com.cn/supercrsky/comments/384283.html//www.ot7t.com.cn/supercrsky/articles/384283.html#Feedback1//www.ot7t.com.cn/supercrsky/comments/commentRss/384283.html//www.ot7t.com.cn/supercrsky/services/trackbacks/384283.html前言?/span>
今天遇到这个sql服务无法启用 。无法登?的情况。。在google 百度 搜了一下。发现很多网站都是采集来的数据。。(很奇怪这些采集站都那么靠前!?/span>
照着文章里边的方法去试试都不行,,,后来终于找到一个。。记录再??原文转自 ://www.networkquestions.org/?p=389 ,感谢一下原作者的辛苦?/span>
本地计算机上的MSSQLSERVER服务启动后又停止了。一些服务自动停止,如果它们没有什么可做的,例?#8220;性能日志和警?#8221;服务?/span>
打开日志查看器开始看日志?/span>
SQL Server 无法生成 FRunCM 线程。请查看 SQL Server 错误日志?Windows 事件日志,获取有关可能发生的相关问题的信息?/span>
由于网络库中存在内部错误,所以无法启动网络库。要确定原因,请查看错误日志中紧位于此错误之前的那些错误?/span>
TDSSNIClient 初始化失败,出现错误 0x7e,状态代?0×1?/span>
接着查看SQL日志 (MSSQL.1MSSQLLOG)
可以判定,可能是以下几个问题?/span>
1、IP地址配置不正确:
打开 Microsoft SQL Server 2005配置工具下的SQL Server Configuration Manager,选择MSSQLSERVER协议, 然后双击右边窗口的TCP/IP,在弹出窗口中检查IP配置?/span>
2、可能是因为VIA协议启用造成的。解决方法如下:
另外,管理员密码修改也会造成sqlserver服务无法启动。解决方法如下:
打开 Microsoft SQL Server 2005配置工具下的SQL Server Configuration Manager,在MSSQLSERVER服务属性中,修改以哪个账号来启动服务?/span>
我机器启动不了服务的原因就是启用?“VIA”服务,禁用后,OK了?/span>


]]>
Spring mongodb 之简单CRUD - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/supercrsky/articles/382858.html々上善若水?/dc:creator>々上善若水?/author>Thu, 12 Jul 2012 02:42:00 GMT//www.ot7t.com.cn/supercrsky/articles/382858.html//www.ot7t.com.cn/supercrsky/comments/382858.html//www.ot7t.com.cn/supercrsky/articles/382858.html#Feedback0//www.ot7t.com.cn/supercrsky/comments/commentRss/382858.html//www.ot7t.com.cn/supercrsky/services/trackbacks/382858.html//www.mkyong.com/mongodb/  
用MyEclipse添加maven-Project工程,在这之前你可能需要配置你的m2eclipse
1.将maven配置成你自己安装的版本?br />

2.设置User Settings
当然也可以修改仓库默认目录,打maven安装目录conf/setting.xml
?lt;settings>节点?br />添加?lt;localRepository>d:/myrepository</localRepository>即可


pom.xml

<project xmlns="//maven.apache.org/POM/4.0.0" xmlns:xsi="//www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="//maven.apache.org/POM/4.0.0 //maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.test</groupId>
  <artifactId>mongodb</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>springmongodb</name>
  <description>This is test case</description>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  
  <repositories>
        <repository>
            <id>spring-milestone</id>
            <name>Spring Maven MILESTONE Repository</name>
            <url>//maven.springframework.org/milestone</url>
        </repository>
    </repositories>
 
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>
 
        <!-- Spring framework -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>3.0.5.RELEASE</version>
        </dependency>
 
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.0.5.RELEASE</version>
        </dependency>
 
        <!-- mongodb java driver -->
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongo-java-driver</artifactId>
            <version>2.5.2</version>
        </dependency>
 
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-mongodb</artifactId>
            <version>1.0.0.M2</version>
        </dependency>
 
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>2.2</version>
        </dependency>
 
    </dependencies>
    
</project>
写完pom.xml后,执行 项目-右键-run-maven install 
下载完jar包,Test 成功后,就可以写代码了?br />SpringMongoConfig.java
package com.config;

import org.springframework.context.annotation.Bean;
import org.springframework.data.document.mongodb.MongoTemplate;
import org.springframework.data.document.mongodb.config.AbstractMongoConfiguration;

import com.mongodb.Mongo;

public class SpringMongoConfig extends AbstractMongoConfiguration
{
    //主机
    @Override
    public Mongo mongo() throws Exception {
        return new Mongo("localhost");
    }
    //数据?/span>
    @Override
    public @Bean MongoTemplate mongoTemplate() throws Exception {
        return new MongoTemplate(mongo(), "test");
    }

}
实体?
package entity;

import java.util.List;

public class User
{

    private String id;
    private String username;
    private String password;
    //文中的集合
    private List<String> position;

    // 要有声明默认的构造方法,不然查询的时候会报错(无法实例?
    public User()
    {

    }

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public String getUsername()
    {
        return username;
    }

    public void setUsername(String username)
    {
        this.username = username;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public List<String> getPosition()
    {
        return position;
    }

    public void setPosition(List<String> position)
    {
        this.position = position;
    }

    public User(String id, String username, String password,
            List<String> position)
    {
        super();
        this.id = id;
        this.username = username;
        this.password = password;
        this.position = position;
    }

    public User(String username, String password, List<String> position)
    {
        super();
        this.username = username;
        this.password = password;
        this.position = position;
    }

}
测试?
package run;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.data.document.mongodb.MongoOperations;
import org.springframework.data.document.mongodb.query.Criteria;
import org.springframework.data.document.mongodb.query.Query;
import org.springframework.data.document.mongodb.query.Update;

import com.config.SpringMongoConfig;

import entity.User;

public class App
{
    private ApplicationContext ctx = new AnnotationConfigApplicationContext(
            SpringMongoConfig.class);
    private MongoOperations mongoOperations = (MongoOperations) ctx
            .getBean("mongoTemplate");

    @Test
    public void testSave()
    {
        List<String> list = new ArrayList<String>();
        for(int i =0; i < 100; i ++)
        {
            list.add("开? + i);
            list.add("经理" + i);
            User user = new User("John" + i,"123" + i,list);
            //第一个参数:要保存的表名,默认为实例名user同名的集??
            
//如果表不存在会自动创? 表名user为关键字不要使用
            mongoOperations.save("userinfo", user);
            list.clear();
        }
    }

    @Test
    public void testUpdate()
    {
        mongoOperations.updateFirst("userinfo",
                new Query(Criteria.where("username").is("John0")),
                Update.update("password", "newpassword"));
    }

    @Test
    public void testDelete()
    {
        mongoOperations.remove("userinfo",new Query(Criteria.where("id").is("4ffe3486b41f8ed41269a729")),User.class);
    }

    @Test
    public void testQuery()
    {
        //输出所有表?/span>
        Set<String> set = mongoOperations.getCollectionNames();
        Iterator<String> it =  set.iterator();
        while(it.hasNext())
        {
            System.out.println(it.next());
        }
        //user:要查询的表名
        List<User> users = mongoOperations.getCollection("userinfo", User.class);
        System.out.println(users.size());
        for(User u : users)
        {
            System.out.println(u.getId());
        }
    }

}

源码下载

]]>
Eclipse之Maven3设置Repository - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/supercrsky/articles/382797.html々上善若水?/dc:creator>々上善若水?/author>Wed, 11 Jul 2012 06:44:00 GMT//www.ot7t.com.cn/supercrsky/articles/382797.html//www.ot7t.com.cn/supercrsky/comments/382797.html//www.ot7t.com.cn/supercrsky/articles/382797.html#Feedback0//www.ot7t.com.cn/supercrsky/comments/commentRss/382797.html//www.ot7t.com.cn/supercrsky/services/trackbacks/382797.html1?修改%M3_HOME%\conf\setting.xml

<localRepository>d:/myrepository</localRepository>
2.打开MyEclispe,更新下就能看到刚才的设置了?br />



另附两个资源库地址?br />

maven lib repo

//repo1.maven.org/maven2/

 

JAR Search

//www.findjar.com/index.x





]]>
mongodb之java CRUD 简单操?/title><link>//www.ot7t.com.cn/supercrsky/articles/382510.html</link><dc:creator>々上善若水?/dc:creator><author>々上善若水?/author><pubDate>Sun, 08 Jul 2012 02:25:00 GMT</pubDate><guid>//www.ot7t.com.cn/supercrsky/articles/382510.html</guid><wfw:comment>//www.ot7t.com.cn/supercrsky/comments/382510.html</wfw:comment><comments>//www.ot7t.com.cn/supercrsky/articles/382510.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/supercrsky/comments/commentRss/382510.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/supercrsky/services/trackbacks/382510.html</trackback:ping><description><![CDATA[驱动包下载:https://github.com/mongodb/mongo-java-driver/downloads<br />我下载的?nbsp;<a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; color: #4183c4; text-decoration: none; ">mongo-2.8.0.jar</a> — Version 2.8.0<br />打开mongo shell -- 新建数据库test --( use test)<br />打开eclipse新建工程,把junit,mongo-2.8.0.jar导入?br />新建测试类如下:<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />//www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">package</span> com.db;<br /><br /><span style="color: #0000FF; ">import</span> java.net.UnknownHostException;<br /><span style="color: #0000FF; ">import</span> java.util.ArrayList;<br /><span style="color: #0000FF; ">import</span> java.util.List;<br /><br /><span style="color: #0000FF; ">import</span> org.bson.types.ObjectId;<br /><span style="color: #0000FF; ">import</span> org.junit.After;<br /><span style="color: #0000FF; ">import</span> org.junit.Test;<br /><br /><span style="color: #0000FF; ">import</span> com.mongodb.BasicDBObject;<br /><span style="color: #0000FF; ">import</span> com.mongodb.DB;<br /><span style="color: #0000FF; ">import</span> com.mongodb.DBCollection;<br /><span style="color: #0000FF; ">import</span> com.mongodb.DBCursor;<br /><span style="color: #0000FF; ">import</span> com.mongodb.DBObject;<br /><span style="color: #0000FF; ">import</span> com.mongodb.Mongo;<br /><span style="color: #0000FF; ">import</span> com.mongodb.MongoException;<br /><br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> DBUtils {<br />    <span style="color: #0000FF; ">private</span> <span style="color: #0000FF; ">static</span> Mongo mongo;<br />    <span style="color: #0000FF; ">private</span> <span style="color: #0000FF; ">static</span> DB db;<br />    <span style="color: #0000FF; ">static</span> {<br />        <span style="color: #0000FF; ">try</span> {<br />            mongo = <span style="color: #0000FF; ">new</span> Mongo("localhost", 27017);<br />        } <span style="color: #0000FF; ">catch</span> (UnknownHostException e) {<br />            e.printStackTrace();<br />        } <span style="color: #0000FF; ">catch</span> (MongoException e) {<br />            e.printStackTrace();<br />        }<br />        db = mongo.getDB("test");<br />    }<br /><br />    @After<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> output() {<br />        <span style="color: #008000; ">//</span><span style="color: #008000; "> 测试完显示所?/span><span style="color: #008000; "><br /></span>        DBCollection dbc = db.getCollection("user");<br />        DBCursor cursor = dbc.find();<br />        <span style="color: #0000FF; ">while</span> (cursor.hasNext()) {<br />            <span style="color: #008000; ">//</span><span style="color: #008000; "> cursor.next就是一行记?一个文?</span><span style="color: #008000; "><br /></span>            System.out.println(cursor.next());<br />        }<br />    }<br /><br />    @Test<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> testInsert() <span style="color: #0000FF; ">throws</span> Exception {<br />        DBCollection dbc = db.getCollection("user");<br />        DBObject object = <span style="color: #0000FF; ">new</span> BasicDBObject();<br />        object.put("username", "zdw");<br />        object.put("password", "123");<br />        <span style="color: #008000; ">//</span><span style="color: #008000; "> 一个人有一个职?br />        </span><span style="color: #008000; ">//</span><span style="color: #008000; "> 数据库json格式:{username:"zdw",password:"123",position:{name:"工程?}}</span><span style="color: #008000; "><br /></span>        BasicDBObject o = <span style="color: #0000FF; ">new</span> BasicDBObject();<br />        o.put("name", "经理");<br />        object.put("position", o);<br />        dbc.insert(object);<br /><br />        object = <span style="color: #0000FF; ">new</span> BasicDBObject();<br />        object.put("username", "zhangjun");<br />        object.put("password", "456");<br />        <span style="color: #008000; ">//</span><span style="color: #008000; "> 一个人有多个职?一个文?里有多个文?<br />        </span><span style="color: #008000; ">//</span><span style="color: #008000; "> 数据库json格式:{username:"zhangjun",password:"456",position:[{name:"工程?},{name:"设计?}]}</span><span style="color: #008000; "><br /></span>        List<Object> list = <span style="color: #0000FF; ">new</span> ArrayList<Object>();<br />        o = <span style="color: #0000FF; ">new</span> BasicDBObject();<br />        o.put("name", "工程?);<br />        list.add(o);<br />        o = <span style="color: #0000FF; ">new</span> BasicDBObject();<br />        o.put("name", "设计?);<br />        list.add(o);<br />        object.put("position", list);<br />        dbc.insert(object);<br />    }<br /><br />    <span style="color: #008000; ">//</span><span style="color: #008000; "> 删除指定</span><span style="color: #008000; "><br /></span>    @Test<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> testRemoveOne() <span style="color: #0000FF; ">throws</span> Exception {<br />        DBCollection dbc = db.getCollection("user");<br />        DBObject o = <span style="color: #0000FF; ">new</span> BasicDBObject();<br />        o.put("username", "zhangjun");<br />        dbc.remove(o);<br />    }<br /><br />    @Test<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> testModify() <span style="color: #0000FF; ">throws</span> Exception {<br />        DBCollection dbc = db.getCollection("user");<br />        <span style="color: #008000; ">//</span><span style="color: #008000; "> 根据id修改密码,需要加$set,否则所有记录的password都会被修改,其它字段删除?/span><span style="color: #008000; "><br /></span>        <span style="color: #0000FF; ">int</span> result = dbc.update(<br />                        <span style="color: #0000FF; ">new</span> BasicDBObject("_id", <span style="color: #0000FF; ">new</span> ObjectId(<br />                                "4ff8eaa65dbc67340278a07c")),<br />                        <span style="color: #0000FF; ">new</span> BasicDBObject("$set", <span style="color: #0000FF; ">new</span> BasicDBObject("password",<br />                                "4444"))).getN();<br />        System.out.println(result);<br />    }<br /><br />    @Test<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> testRemove() <span style="color: #0000FF; ">throws</span> Exception {<br />        DBCollection dbc = db.getCollection("user");<br />        <span style="color: #008000; ">//</span><span style="color: #008000; "> 删除全部</span><span style="color: #008000; "><br /></span>        dbc.drop();<br />    }<br /><br />    <span style="color: #008000; ">//</span><span style="color: #008000; "> 查询指定</span><span style="color: #008000; "><br /></span>    @Test<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> testFindOne() <span style="color: #0000FF; ">throws</span> Exception {<br />        DBCollection dbc = db.getCollection("user");<br />        DBObject o = <span style="color: #0000FF; ">new</span> BasicDBObject();<br />        o.put("username", "zdw");<br />        DBObject obj = dbc.findOne(o);<br />        System.out.println(obj);<br />    }<br /><br />}</div><br />这种key-value存储方式,操作很方便?br /><a title="源码下载">源码下载</a><br /><img src ="//www.ot7t.com.cn/supercrsky/aggbug/382510.html" width = "1" height = "1" /><br><br><div align=right><a href="//www.ot7t.com.cn/" title="四川福利彩票快乐12">四川福利彩票快乐12</a></div>]]></description></item></channel></rss> <script>(function(){ var src = (document.location.protocol == "http:") ? "//js.passport.qihucdn.com/11.0.1.js?f7a6bc378844a5df707c414e6b6fea33":"https://jspassport.ssl.qhimg.com/11.0.1.js?f7a6bc378844a5df707c414e6b6fea33"; document.write('<script src="' + src + '" id="sozz"><\/script>'); })(); </script>