mysql下载,mysql

使用的框架技术太多,以此作为笔记,避免他日忘记。
一、maven
1.先装jdk1.4+ ,设置环境变量,检查java -version ;(jdk必须安装成功!);
2.下载maven: http://maven.apache.org/ ; 把Maven的可执行程序目录加到系统环境;检查mvn -version;
3.使用maven新建工程,运行cmd窗口,输入下面命令
例:mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=javaProj -DartifactId=javaProj
mvn是Maven的主命令,几乎所有的任务都由mvn这个命令完成。其中 archetype:create 表示我们要使用Maven执行项目的生成的任务。
-DarchetypeGroupId=org.apache.maven.archetypes 用于引入此项目在创建时所使用的项目模型组,它用于指定要生成的Java项目类型。实际上Maven可以生成各种各样的Java项目,如Web应用或带Hibernate的Web应用等,随指定的项目类型不同,这些应用需要的函数库各自不同,程序目录架构也不尽相同。我们稍后会看到用maven创建web项目的例子,在这里,我们使用 -DarchetypeGroupId=org.apache.maven.archetypes 生成默认的普通Java工程。接下来我们看 -DgroupId=javaProj及-DartifactId=javaProj ,这两个参数给我们要创建的项目起个名字,并且成为唯一标识我们这个项目的信息。以上命令执行完成后会生成pom.xml文件,这个文件相当于Ant的build.xml,是maven生成工程的配置文件。
4.打开cmd窗口,进入生成的工程文件夹,也就是pom.xml所在的目录,输入mvn eclipse:eclipse;会生成.project及.classpath文件,用eclipse就可以直接导入此工程了。
第一次新建工程时,会创建maven的仓库文件夹,默认会些路径:C:\Users\Administrator\.m2。用来存放工程所需要的jar包,这里需要注意的是,工程所依赖的jar都是maven自动从网上Down下来的,所以会有点慢。
可以指定maven的仓库文件夹位置,apache-maven-3.0.3-bin\apache-maven-3.0.3\conf\settings.xml文件中的localRepository一项。
使用eclipse导入工程后,还需要配置m2_repo,指定工程所引用的仓库文件夹位置。
eclipse>>window>>preferences>>java>>Build Path>>Classpath Variables>>new
name:m2_repo
path:你的localRepository的路径
maven命令:
mvn -version
mvn eclipse:eclipse
mvn eclipse:clean clean
mvn package
mvn archetype:generate
mvn jetty:run
创建web工程
mvn archetype:generate
-DgroupId=com.ray
-DartifactId=webappdemo
-Dpackage=com
-DarchetypeArtifactId=maven-archetype-webapp
-Dversion=1.0
-DinteractiveMode=No
二.ibatis
1.导包
ibatis-sqlmap-2.3.0.jar
ibatis-dao-2.jar
ibatis-common-2.jar
2.编写sqlMapConfig.xml.这个文件是ibatis的主要配置文件,相当于hibernate.cfg.xml,可以在里面配置数据源,连接数,还有实体映射文件。
sqlMapConfig.xml
——————————————————————————————
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<!-- Always ensure to use the correct XML header as above! -->
<sqlMapConfig>
<!-- The properties (name=value) in the file specified here can be used placeholders in this config file (e.g. “${driver}”. The file is relative to the classpath and is completely optional. -->
<properties resource="SqlMapConfigExample.properties" />
<!-- These settings control SqlMapClient configuration details, primarily to do with transaction
management. They are all optional (more detail later in this document). -->
<settings
cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
maxRequests="32"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
<!-- Type aliases allow you to use a shorter name for long fully qualified class names. -->
<typeAlias alias="User" type="model.User"/>
<!-- Configure a datasource to use with this SQL Map using SimpleDataSource.
Notice the use of the properties from the above resource -->
<transactionManager type="JDBC" >
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
<property name="JDBC.DefaultAutoCommit" value="true" />
<property name="Pool.MaximumActiveConnections" value="10"/>
<property name="Pool.MaximumIdleConnections" value="5"/>
<property name="Pool.MaximumCheckoutTime" value="120000"/>
<property name="Pool.TimeToWait" value="500"/>
<property name="Pool.PingQuery" value="select 1 from ACCOUNT"/>
<property name="Pool.PingEnabled" value="false"/>
<property name="Pool.PingConnectionsOlderThan" value="1"/>
<property name="Pool.PingConnectionsNotUsedFor" value="1"/>
</dataSource>
</transactionManager>
<!-- Identify all SQL Map XML files to be loaded by this SQL map. Notice the paths
are relative to the classpath. For now, we _disibledevent=>
</sqlMapConfig>
3.由于上面sqlMapCofing.xml引用了SqlMapConfigExample.properties,所以还需要编写这个文件。
SqlMapConfigExample.properties
————————————————————————————————————————————————
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://127.0.0.1/raydata?user=root&password=sa&useUnicode=true&&characterEncoding=utf-8&autoReconnect = true
DatabaseName=raydata
username=root
password=sa
未完,待续……
mysql下载,mysql
三.spring

四.freemarker
Tags:  mysql下载

延伸阅读

最新评论

发表评论