web与sql服务器搭建
㈠ 如何在web中使用activiti和sql server
一、按照如下方式新建一个web工程
之所以要用maven,主要是为了解决各种依赖项的问题,用maven来管理依赖项还是很方便的。
用Eclipse创建Maven结构的web项目的时候选择了Artifact
Id为maven-artchetype-webapp,由于这个catalog比较老,用的servlet还是2.3的,而一般现在都是用3.0,在
Project Facets里面修改Dynamic web mole为3.0的时候就会出现Cannot change version of
project facet Dynamic web mole to 3.0,如图:
解决这个问题的步骤如下:
1. 把Servlet改成3.0,打开项目的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="schele-console" version="3.0">
2. 修改项目的设置,在Navigator下打开项目.settings目录下的org.eclipse.jdt.core.prefs
把1.5改成1.8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
3. 打开org.eclipse.wst.common.project.facet.core.xml
把java改为1.8, 把jst.web改为3.0;
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.8"/>
</faceted-project>
二、解决报错The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
可以使用如下步骤来解决。
1、右击web工程-》属性或Build Path-》Java Build Path->Libraries-> Add Libray...->Server Runtime -》Tomcat Server
2、切换到Java Build Path界面中的Orader and Export,选择Tomcat。
三、修改项目的pom.xml文件,添加activiti相关依赖项
相关依赖项如下:
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>${activiti-version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>${activiti-version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.3</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.168</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
其中activiti-version的定义如下:
<properties>
<activiti-version>5.18.0</activiti-version>
</properties>
其实这些内容我都是从Activiti工程的pom文件中拷贝过来的。
四、添加activiti需要的配置文件
在activiti的userguide(http://activiti.org/userguide/index.html#_configuration )中有说。
如果我们使用如下语句来创建一个流程引擎实例
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine()
那么实际上他是到该项目的classpath路径下去找一个名为
activiti.cfg.xml的配置文件,然后根据该配置文件的设置,通过spring的方式来创建一个processEngine。而且是去找其中
的那个名字是default的processEngine。
所以我们可以在该项目的src/main/resources 目录下创建一个名为 activiti.cfg.xml的文件,然后将如下内容复制进去。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.">
</bean>
</beans>
五、创建sql server数据库
通过sql server management studio 创建一个数据库,比如名字叫做 activiti
六、在maven中添加sql server jdbc依赖项
在maven仓库中是没有sql server 的jdbc jar包的,可以按照如下步骤操作
Download the JDBC driver for Microsoft SQL Server
Visit the MSDN site for SQL Server and download the latest version of the JDBC driver for your operating system.
Unzip the package
Open a command prompt and switch into the expanded directory where the jar file is located.
Execute the following command. Be sure to modify the jar file name and version as necessary:
1
mvn install:install-file -Dfile=sqljdbc4.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0
You should see something similar to this:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /Users/claude/installers/JDBC/sqljdbc_4.0/enu/sqljdbc4.jar to /Users/claude/.m2/repository/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.jar
[INFO] Installing /var/folders/c6//T/mvninstall1874482299687761721.pom to /Users/claude/.m2/repository/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.208s
[INFO] Finished at: Tue Mar 13 14:07:31 EDT 2012
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------
Modify your POM
Include the new dependency by modifying your project’s pom.xml. Add the following dependency:
1
2
3
4
5
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
Save the pom.xml file and build the project to make sure no errors exist.
七、让activiti连接sql server数据库
修改第四节中的activiti.cfg.xml文件,将 processEngineConfiguration的内容改成下文这样:
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.">
<property name="databaseSchemaUpdate" value="true"/>
<property name="jdbcUrl" value="jdbc:sqlserver://localhost:1433;databaseName=activiti2 " />
<property name="jdbcDriver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="sa123" />
</bean>
八、在代码中使用activiti的api
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
if(processEngine != null)
{
out.println("<h1> Hello !" + processEngine.getName() + "</h1>");
IdentityService identityService = processEngine.getIdentityService();
List<String> keys = identityService.getUserInfoKeys("Kermit");
for(String key: keys)
{
out.println(String.format("<h1> key = %s, value = %s </h1>", key, identityService.getUserInfo("Kermit", key)));
}
}
以上在调用 ProcessEngines.getDefaultProcessEngine(); 的时候,实际上背后就会去调用搜索classPath目录下的activiti.cfg.xml文件,然后通过其中的配置来创建processEngine对象。
九、在eclipse中调试activiti项目
在eclipse中调试web项目,其实他是把相关的资料生成到如下路径:
<eclipse workspace dir>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\MavenWeb
如果发现某项配置修改之后,调试的时候没有生效,那可以试着clean一下, Project ->clean...,然后重新生成即可。
㈡ 我想在WIN7上做一个WEB(网站)服务器,运行的是ASP程序和MSSQL数据库,请问怎么做
1.安装IIS (部分版本的win7不含iis)
开始-控制面板-程序-打开或关闭windows功能
勾选internet信息服务,确保列表树中的asp被勾上。
2.配置IIS7
IIS7 在安装了上述组件后,控制面板-系统和安全-管理工具-Internet信息服务(慎败IIS)
管理工具,打开运行。明态双击内页中的ASP,即显示ASP的设置内容,"宽槐颤,然后在"Behavior(行为)"组中将"Enable Parent Paths(启用父路径)"设置为True即可。配置默认网站,填写 物理路径、应用程序池,点OK即可。
顺便说一下:
我是win7 64位系统,之前在搭建asp+access时发现要进行如下设置:
应用程序池,高级设置-->允许32位应用程序 True
否则无法连接数据库。
㈢ web服务器是否一定要安装SQL
问题1:要调用数据库当然要有相应的数据库服务器来执行你应用程序发过来的sql语句,然后把执行的结果返回给应用程序了。所以肯定是要安装数据库服务器的,我说的是不用远程数据库的话。
问题2:用SqlServer举例,安装一个sql server实例后春茄,就会有一个mdf文件,这个mdf文件里存有该数据库实例的大坦竖部门的信息,以后新扒信察建的数据库都会存在该文件里,所以新建一个数据库不会再产生mdf文件,只会在原来的mdf追加数据。
㈣ 如何在web中建立 自己的sql数据库
数据库种类很多,有关系型数吵早埋据库、非关系型数据库
企业升蚂开发中用的较多的是三种关系型数据库:MySQL、MS SQL SERVER、Oracle。
中小企业网站中可以使用单文件数据库:Access、Sqlite等
前三种睁察是需要单独安装到服务器中,后二者都是单个文件,有专门的软件生成。
㈤ 仅仅使用sql而不需要其他高级语言能搭建一个网站吗
sql是一种数据库查询语言,其它高级语言只是派歼用来编程实现某种功能软件,或是某些软件的脚本。
仅仅使用sql语言是不能实现一个网站的功能,要实现网站功能也就是要实现WEB服务器。
Web服务器一般指网站服务器,是指驻留于因特网上某种类型尘并冲计算机的程序,可以向浏览器等Web客户端提供文档,也可以放置网站文件,让全世界浏览;可以放置数据文件,让全世界下载。目蔽滚前最主流的三个Web服务器是Apache、 Nginx 、IIS。
而sql语言是sql服务器的查询语言,sql服务器主要是为web服务器服务的。
㈥ WEB加SQL WIN2003需要搭建什么服务器软件
IIS就够了。
win2003自带。
㈦ 如何搭建数据库服务器和web服务器
分别说明一下web服务器和数据库服务器,以下就是两者的区别:
1、web服务器
web服务器一般指网站服务器,是指驻留于因特网上某种类型计算机的程序,可以向浏览器等web客户端提供文档。
web服务器可以放置网站文件,让全世界浏览;可以放置数据文件,让全世界下载。
目前最主流的三个web服务器是:apache、nginx、iis。
2、数据库服务器
运行在局域网中的一台或多台计算机和数据库管理系统软件共同构成了数据库服务器,数据库服务器为客户应用提供服务,这些服务是查询、更新、事务管理、索引、高速缓存、查询优化、安全及多用户存取控制等。
㈧ web服务器和数据库服务器怎么连接
如果两个服务是不同的服务器,数据库服务器需要开启对应的外网访问端口并进行设置。如果是在同一个服务器上,使用数据库连接程序、账号密码即可连接。
㈨ 怎样把sql数据库和web服务器连接起来
public Connection getNewConnection(){
Connection con=null;
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
con=DriverManager.getConnection("jdbc:mysql://localhost(或者你连的主机IP):3306/数岁知据库乎纤消名称","用户名","密码");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return con;
}
这是一个连接竖档mysql的例子
㈩ APP的本地服务器如WEBSQL和数据库服务器MYSQL怎么建立连接,能不能举个详细的例子
最简单的理解哈(个人理解),昌档服务器,顾名耐册乱思义,就是放服务的地方,就是发布各种服务的主机,比如说网站呀之类的,如Web服务器。数据库的话,简单说也就是放数据的地方,管理数据的一个系统。
举个例子哈,比如你在服务器上发布了个网站(一般都是动态的啦),这网站是有数据吧,数据就是从数据库读出来,这数据库可以和这些网站放在同一主机,也可以放在另外一台主机。
如果把网站放一个主机,把数据库放一个主机,这样的话,放网站的主机就叫Web服务器,放数据库的主机就叫数据库服务器。
不晓得你想要了解到啥程度,偶说的自我感觉非常非常非姿运常的浅,也不晓得说的对不对,你看一下就行了。。呵呵。。