springMVC多数据源使用 跨库跨连接
原文:http://blog.itpub.net/9399028/viewspace-2106641/
http://blog.csdn.net/a973893384/article/details/21460121
有的时候项目中可能要从另外一个系统取数据 如果另外一个系统能提供接口就很好解决 如果没有接口 便可以配置多个数据源切换访问
<1>:这是数据源和事务扫描注入的配置 访问多个数据源只需要建立多个数据源和事务这一套配置文件
这是第一个数据源
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
default-lazy-init="true"> <description>Spring公共配置 </description> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:resources.properties</value>
<!-- <value>classpath:memcached.properties</value> -->
</list>
</property>
</bean> <!-- dubbo配置 -->
<!-- <dubbo:application name="xaUserRegPro" />
<dubbo:registry address="multicast://" />
<dubbo:reference id="userRegProService" interface="com.xinnet.xa.service.UserRegProService" timeout="6000"/> --> <!-- **************** druid 监控连接池配置 ***************** -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <!-- 基本属性 url、user、password -->
<property name="url" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" /> <!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="${initialSize}" />
<property name="minIdle" value="${minIdle}" />
<property name="maxActive" value="${maxActive}" /> <!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="${maxWait}" /> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000" /> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="300000" />
<property name="validationQuery" value="SELECT 'x'" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" /> <!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
<!-- 如果用Oracle,则把poolPreparedStatements配置为true,mysql可以配置为false。分库分表较多的数据库,建议配置为false -->
<property name="poolPreparedStatements" value="${poolPreparedStatements}" />
<property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> <!-- 对泄漏的连接 自动关闭 -->
<property name="removeAbandoned" value="${removeAbandoned}" /> <!-- 打开removeAbandoned功能 -->
<property name="removeAbandonedTimeout" value="${removeAbandonedTimeout}" /> <!-- 1800秒,也就是30分钟 -->
<property name="logAbandoned" value="${logAbandoned}" /> <!-- 关闭abanded连接时输出错误日志 --> <!-- 配置监控统计拦截的filters -->
<property name="filters" value="mergeStat" />
<!-- <property name="filters" value="stat" /> -->
<!-- 慢日志查询 缺省为3秒 修改为10秒 10000 -->
<property name="connectionProperties" value="druid.stat.slowSqlMillis=5000" /> <!-- DruidDataSource各自独立 , 支持配置公用监控数据 -->
<!-- <property name="useGloalDataSourceStat" value="true" /> -->
</bean> <!-- druid 监控 spring -->
<bean id="druid-stat-interceptor" class="com.alibaba.druid.support.spring.stat.DruidStatInterceptor"/>
<bean id="druid-stat-pointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut" scope="prototype">
<property name="patterns">
<list>
<value>com.xinnet.*.service.*</value>
</list>
</property>
</bean>
<aop:config>
<aop:advisor advice-ref="druid-stat-interceptor" pointcut-ref="druid-stat-pointcut" />
</aop:config> <!-- MyBatis Mapper.XMl 配置 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:config/mybatis.xml" />
<property name="mapperLocations">
<list>
<!-- 自动匹配Mapper映射文件 -->
<value>classpath:mapper/**/*-mapper.xml</value>
</list>
</property>
<!-- 添加插件 -->
<property name="plugins">
<array>
<ref bean="pagePlugin" />
</array>
</property>
</bean> <!-- 支持文件上传相关 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/> <!-- 分页插件,根据方言自动添加分页信息,默认要求 -->
<bean id="pagePlugin" class="com.xinnet.core.mybatis.plugin.PagePlugin">
<property name="properties">
<props>
<prop key="dialect">com.xinnet.core.mybatis.dialet.MySQLDialect</prop>
<prop key="pageSqlId">.*query.*</prop>
</props>
</property>
</bean>
<!-- redis客户端 -->
<!-- jedis pool配置 -->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxActive" value="${redis.maxActive}" />
<property name="maxIdle" value="${redis.maxIdle}" />
<property name="maxWait" value="${redis.maxWait}" />
<property name="testOnBorrow" value="${redis.testOnBorrow}" />
</bean> <bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="usePool" value="true"></property>
<property name="hostName" value="${redis.host}" />
<property name="port" value="${redis.port}" />
<property name="password" value="${redis.pass}" />
<property name="timeout" value="${redis.timeout}" />
<property name="database" value="${redis.default.db}"></property>
<constructor-arg index="0" ref="jedisPoolConfig" />
</bean>
<bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
<property name="connectionFactory" ref="jedisConnectionFactory" />
</bean> <!-- ***************事务配置************** -->
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<aop:config>
<aop:advisor pointcut="execution(* com.xinnet..service..*.*(..))" advice-ref="txAdvice" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="query*" read-only="true" />
<tx:method name="find*" read-only="true" />
<tx:method name="load*" read-only="true" />
<tx:method name="select*" read-only="true" />
<tx:method name="count*" read-only="true" />
<tx:method name="search*" read-only="true" />
<tx:method name="list*" read-only="true" />
<tx:method name="*" propagation="REQUIRED" rollback-for="Exception" />
</tx:attributes>
</tx:advice>
<aop:aspectj-autoproxy proxy-target-class="true"/>
<!-- 开启注解事务 只对当前配置文件有效 --> <!-- 扫描注解Bean -->
<context:component-scan base-package="com.xinnet">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/>
<context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<!-- 隐式地向 Spring 容器注册 -->
<context:annotation-config/> </beans>
<2>这是第二个数据源 和第一个数据源一样 需要有事务 扫描注解
不同的是数据源的 url username 和password 用的是第二个数据源的连接 用户名和密码
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
default-lazy-init="true"> <description>Spring公共配置 </description> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:resources.properties</value>
<!-- <value>classpath:memcached.properties</value> -->
</list>
</property>
</bean> <!-- **************** druid 监控连接池配置 ***************** -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <!-- 基本属性 url、user、password -->
<property name="url" value="${url2}" />
<property name="username" value="${username2}" />
<property name="password" value="${password2}" /> <!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="${initialSize}" />
<property name="minIdle" value="${minIdle}" />
<property name="maxActive" value="${maxActive}" /> <!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="${maxWait}" /> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000" /> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="300000" />
<property name="validationQuery" value="SELECT 'x'" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" /> <!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
<!-- 如果用Oracle,则把poolPreparedStatements配置为true,mysql可以配置为false。分库分表较多的数据库,建议配置为false -->
<property name="poolPreparedStatements" value="${poolPreparedStatements}" />
<property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> <!-- 对泄漏的连接 自动关闭 -->
<property name="removeAbandoned" value="${removeAbandoned}" /> <!-- 打开removeAbandoned功能 -->
<property name="removeAbandonedTimeout" value="${removeAbandonedTimeout}" /> <!-- 1800秒,也就是30分钟 -->
<property name="logAbandoned" value="${logAbandoned}" /> <!-- 关闭abanded连接时输出错误日志 --> <!-- 配置监控统计拦截的filters -->
<property name="filters" value="mergeStat" />
<!-- <property name="filters" value="stat" /> -->
<!-- 慢日志查询 缺省为3秒 修改为10秒 10000 -->
<property name="connectionProperties" value="druid.stat.slowSqlMillis=5000" /> <!-- DruidDataSource各自独立 , 支持配置公用监控数据 -->
<!-- <property name="useGloalDataSourceStat" value="true" /> -->
</bean> <!-- druid 监控 spring -->
<bean id="druid-stat-interceptor" class="com.alibaba.druid.support.spring.stat.DruidStatInterceptor"/>
<bean id="druid-stat-pointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut" scope="prototype">
<property name="patterns">
<list>
<value>com.xinnet.*.service.*</value>
</list>
</property>
</bean>
<aop:config>
<aop:advisor advice-ref="druid-stat-interceptor" pointcut-ref="druid-stat-pointcut" />
</aop:config> <!-- MyBatis Mapper.XMl 配置 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:config/mybatis.xml" />
<property name="mapperLocations">
<list>
<!-- 自动匹配Mapper映射文件 -->
<value>classpath:mapper/**/*-mapper.xml</value>
</list>
</property>
<!-- 添加插件 -->
<property name="plugins">
<array>
<ref bean="pagePlugin" />
</array>
</property>
</bean> <!-- 支持文件上传相关 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/> <!-- 分页插件,根据方言自动添加分页信息,默认要求 -->
<bean id="pagePlugin" class="com.xinnet.core.mybatis.plugin.PagePlugin">
<property name="properties">
<props>
<prop key="dialect">com.xinnet.core.mybatis.dialet.MySQLDialect</prop>
<prop key="pageSqlId">.*query.*</prop>
</props>
</property>
</bean>
<!-- redis客户端 -->
<!-- jedis pool配置 -->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxActive" value="${redis.maxActive}" />
<property name="maxIdle" value="${redis.maxIdle}" />
<property name="maxWait" value="${redis.maxWait}" />
<property name="testOnBorrow" value="${redis.testOnBorrow}" />
</bean> <bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="usePool" value="true"></property>
<property name="hostName" value="${redis.host}" />
<property name="port" value="${redis.port}" />
<property name="password" value="${redis.pass}" />
<property name="timeout" value="${redis.timeout}" />
<property name="database" value="${redis.default.db}"></property>
<constructor-arg index="0" ref="jedisPoolConfig" />
</bean>
<bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
<property name="connectionFactory" ref="jedisConnectionFactory" />
</bean> <!-- ***************事务配置************** -->
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<aop:config>
<aop:advisor pointcut="execution(* com.xinnet..service..*.*(..))" advice-ref="txAdvice" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="query*" read-only="true" />
<tx:method name="find*" read-only="true" />
<tx:method name="load*" read-only="true" />
<tx:method name="select*" read-only="true" />
<tx:method name="count*" read-only="true" />
<tx:method name="search*" read-only="true" />
<tx:method name="list*" read-only="true" />
<tx:method name="*" propagation="REQUIRED" rollback-for="Exception" />
</tx:attributes>
</tx:advice>
<aop:aspectj-autoproxy proxy-target-class="true"/>
<!-- 开启注解事务 只对当前配置文件有效 --> <!-- 扫描注解Bean -->
<context:component-scan base-package="com.xinnet">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/>
<context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<!-- 隐式地向 Spring 容器注册 -->
<context:annotation-config/> </beans>
<3>这个时候就可以用两个数据源进行切换注入 从而使用不同数据源的service
这是service里面的方法 该怎么写就是怎么写 该怎么注解就怎么注解 不用做特殊的步骤
@Service("partyService")
public class PartyServiceImpl implements PartyService {
@Autowired
private PartyDao partyDao;
@Override
public List<Emp> getAllEmp() throws SQLException {
return partyDao.getAllEmp();
}
}
Dao层也是一样 该怎么写就怎么写 该怎么注解就怎么注解
然后可以写一个测试类试一下连接
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:spring.xml" })//这里的spring.xml加载了第一个数据源 spring-commons.xml
public class DataSourceTest extends AbstractTransactionalJUnit4SpringContextTests {
/**
*
* 功能描述:xxxxx
*
* @throws SQLException
*
* @author xxx[973893384@163.com]
*
* @since 2014年3月12日
*
* @update:[变更日期YYYY-MM-DD][更改人姓名][变更描述]
*/
@Test
@Rollback(true)
public void testGetAllEmp() throws SQLException {
ApplicationContext ac = new FileSystemXmlApplicationContext("classpath:config/hymanager/hymanager_spring.xml");//这里加载的是第二个数据源配置文件路径 使用的时候用application 读取第二个数据源的配置文件 就可以用getBean 获取注入的service 不用ac.getBean 用@Autowired自动注入的 则使用的是第一个数据源
PartyService partyService = (PartyService) ac.getBean("partyService");
List<Emp> list = partyService.getAllEmp();
for (Emp emp : list) {
System.out.println(emp.getEmpno());
}
}
这样就可以封装一个父类
public class DataSourceChange {
//第二个数据源数据源
public ApplicationContext otherDataSource=new FileSystemXmlApplicationContext("classpath:config/hymanager/hymanager_spring.xml");
//默认数据源
public ApplicationContext defaultDataSource=new FileSystemXmlApplicationContext("classpath:config/spring_commons.xml");
/**
*
* 功能描述:xxxx
*
* @param beanName
* @return
*
* @author xxx[973893384@163.com]
*
* @since 2014年3月12日
*
* @update:[变更日期YYYY-MM-DD][更改人姓名][变更描述]
*/
public Object now(String beanName) {
return defaultDataSource.getBean(beanName);
}
public Object after(String beanName) {
return otherDataSource.getBean(beanName);
}
}
要使用多个数据源的类就可以继承这个父类
public class HyMangerEmpDataHandle extends DataSourceChange {
//用父类的after方法更换配置切换第二套数据源获取注入partyService
private PartyService partyService=(PartyService) after("partyService");
//<span style="font-family: Arial, Helvetica, sans-serif;">用父类的now方法更换配置切换第一套数据源获取注入empService
private EmpService empService=(EmpService) now("empService");
private static Logger log=LoggerFactory.getLogger(PartyService.class);
/**
*
* 功能描述:xxxxx
*
* @throws SQLException
*
* @author xxx[973893384@163.com]
*
* @since 2014年3月12日
*
* @update:[变更日期YYYY-MM-DD][更改人姓名][变更描述]
*/
public void leadingAllEmp() throws SQLException {
List<Emp> partyList=partyService.getAllEmp();//第二个数据源注入的service
for(Emp emp:partyList) {
empService.addEmp(emp);//第一个数据源注入的service
}
}
}
springMVC多数据源使用 跨库跨连接的更多相关文章
- SQL Server跨库跨服务器访问实现
我们经常会遇到一个数据库要访问另一个数据库,或者一台服务器要访问另一台服务器里面的数据库. 那么这个如何实现的呢? 相信看完这篇文章你就懂了! 同一台服务器跨库访问实现 1. 首先创建两个数据库Cro ...
- T-SQL——关于跨库连接查询
目录 0. 同一台服务器不同数据库 1. 使用跨库查询函数--OpenDataSource() 2. 使用链接服务器(Linking Server) 3. 使用OpenDataSource()函数和链 ...
- update关联其他表批量更新数据-跨数据库-跨服务器Update时关联表条件更新
1.有时在做项目时会有些期初数据更新,从老系统更新到新系统.如果用程序循环从老系统付给新系统. 2.有时在项目中需要同步程序,或者自动同步程序时会有大量数据更新就可能用到如下方法了. 3.为了做分析, ...
- Spring3.0+Hibernate+Atomikos集成构建JTA的分布式事务--解决多数据源跨库事务
一.概念 分布式事务分布式事务是指事务的参与者.支持事务的服务器.资源服务器以及事务管理器分别位于不同的分布式系统的不同节点之上.简言之,同时操作多个数据库保持事务的统一,达到跨库事务的效果. JTA ...
- oracle跨库连接查询
一.授权(本地客户器端授权当前用户) grant create database link to szfile 第一种连接方法:配置本地数据库服务器的tnsnames.ora文件 SZFILE = ( ...
- 如何使用SQL SERVER数据库跨库查询
SQL Server中内置了数据库跨库查询功能,下面简要介绍一下SQL Server跨库查询.首先打开数据源码:OPENDATASOURCE不使用链接的服务器名,而提供特殊的连接信息,并将其作为四部分 ...
- ACCESS-如何多数据库查询(跨库查询)
测试通过:ACCESSselect * from F:\MYk.mdb.tablename说明:1.查询语句2.来原于哪(没有密码是个路径)3.查询的表名 ====================== ...
- SQL Server 创建跨库查詢、修改、增加、删除
一.通过SQL语句访问远程数据库 --OPENROWSET函数 使用OPENROWSET()是个不错的选择,也可以用做跨库查询包括增.删.改.查 下面就来介绍一下OPENROWSET函数的运用 包 ...
- Postgresql ODBC驱动,用sqlserver添加dblink跨库访问postgresql数据库
在同样是SQLserver数据库跨库访问时,只需要以下方法 declare @rowcount int set @rowcount =(select COUNT(*) from sys.servers ...
随机推荐
- Java线程-线程、程序、进程的基本概念
线程 与进程相似,但线程是一个比进程更小的执行单位.一个进程在其执行的过程中可以产生多个线程. 与进程不同的是同类的多个线程共享同一块内存空间和一组系统资源,所以系统在产生一个线程,或是在各个线程之间 ...
- mysql 插入多条记录,重复值不插入
只去除主键与唯一索引的字段,字段为null时 是可以重复插入的domo: insert ignore into table_name(email,phone,user_id) values('test ...
- 拼图游戏源码-swift版项目源码
作者fanyinan,源码PuzzleProject,公司的项目中需要一个拼图游戏,之前有手动拼图和随机打乱的功能,近期又由于个(xian)人(zhe)爱(dan)好(teng)自己加入了自动拼图功能 ...
- 4K屏选购秘诀
最近我买了一台三星4K 27.7吋显示器,经试用,虽然达到4K标准,但感觉像素精细度不够.明显达不到我的苹果笔记本视网膜屏的精细程度,事后总结一下原因:因为4K屏总的像素是3840×2160,屏越大像 ...
- C++ 类、对象、class
一.对象初始化 1.不能在类声明中对数据成员初始化,因为类只是一个抽象类型,不占存储空间,无处容纳数据. 2.若某类的数据成员都是public,则可以像结构体一样初始化,如 Time t={12,21 ...
- close - 关闭一个文件描述符
SYNOPSIS 总览 #include <unistd.h> int close(int fd); DESCRIPTION 描述 close 关闭 一个 文件 描述符 , 使它 不在 指 ...
- 360浏览器 收藏夹 ico 缓存 目录
C:\Users\Administrator\AppData\Roaming\360se6\apps\data\users\default\data\ico
- JS正则表达式验证(一)
目录: 手机号验证 固定电话验证 手机号验证: 写法[1]--->!(/^1[34578]\d{9}$/.test(phone)):以1开头,第二位可能是3/4/5/7/8等的任意一个,在加上后 ...
- JavaScript:JSON 和 JS 对象
区别 JSON(JavaScript Object Notation)仅仅是一种数据格式(或者叫数据形式).数据格式其实就是一种规范,按照这种规范来存诸和交换数据.就好像 XML 格式一样. 区别 J ...
- JFinal项目eclipse出现Unknown column 'createtime' in 'order clause' 的错误
JFinal项目eclipse出现Unknown column 'createtime' in 'order clause' 的错误,在本次项目中的原因是我的表中的字段信息中创建时间的字段是creat ...