上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 25 下一页
摘要: --增加备份字段alter Table tableName add columnNameBak bigint ;--将主键自增字段 赋值到备份字段update tableNameset columnNameBak = columnName;--删除主键备份字段约束ALTER TABLE tableNameDROP CONSTRAINT PK_shoppingcart--删除主键自增字段alter Table tableName drop column columnName ;--修改备份字段名称--ALTER TABLE tableNameRENAME COLUMN columnNam... 阅读全文
posted @ 2014-04-02 15:51 沐风山 阅读(1844) 评论(0) 推荐(0) 编辑
摘要: 1、重命名表将表OLD重命名为NEW:EXEC sp_rename 'OLD','NEW'2、重命名列将表table1中的列old重命名为new:EXEC sp_rename 'table1.old','new','COLUMN'3、删除主键:Declare @Pk varChar(100);Select @Pk=Name from sysobjects where Parent_Obj=OBJECT_ID('tableName') and xtype='PK';if @Pk is 阅读全文
posted @ 2014-04-02 15:15 沐风山 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 1. select max(id) from tablename2.SELECT LAST_INSERT_ID() 函数LAST_INSERT_ID 是与table无关的,如果向表a插入数据后,再向表b插入数据,LAST_INSERT_ID会改变。在多用户交替插入数据的情况下max(id)显然不能用。这时就该使用LAST_INSERT_ID了,因为LAST_INSERT_ID是基于Connection的,只要每个线程都使用独立的 Connection对象,LAST_INSERT_ID函数将返回该Connection对AUTO_INCREMENT列最新的insert or update 操作生成 阅读全文
posted @ 2014-04-01 12:23 沐风山 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 1.关键字auto_increment2.自增用法例:CREATE TABLE animals ( id mediumint not null auto_increment,name char(30) not null,primary key (id));3.关于自增Q:怎么获得当前的自增的最大值?Q:怎么获得table的当前自增最大值?A:select @@identityA:select max(id) from tableQ:对自增的理解?A: 一般情况下获取刚插入的数据的id,使用select max(id) from table 是可以的。LAST_INSERT_ID 是与table 阅读全文
posted @ 2014-04-01 12:11 沐风山 阅读(594) 评论(0) 推荐(0) 编辑
摘要: JDBC批量插入主要用于数据导入和日志记录因为日志一般都是先写在文件下的等。我用Mysql 5.1.5的JDBC driver 分别对三种比较常用的方法做了测试方法一,使用PreparedStatement加批量的方法try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(o_url, userName, password); conn.setAutoCommit(false); String sql = "INSERT adlogs... 阅读全文
posted @ 2014-03-31 19:19 沐风山 阅读(282) 评论(0) 推荐(0) 编辑
摘要: C3P0在最近的demo中也用了(我用的是0.9.2.1版本),因为单例很难应付大量并发。用法详见文档:http://www.mchange.com/projects/c3p0/基本的用法在http://www.mchange.com/projects/c3p0/#quickstart,以及http://www.mchange.com/projects/c3p0/#using_c3p0中。在项目中更为方便的做法是将配置写在配置文件中。C0P0的配置文件名为c3p0-config.xml,详见http://www.mchange.com/projects/c3p0/#configuration_ 阅读全文
posted @ 2014-03-30 00:19 沐风山 阅读(281) 评论(0) 推荐(0) 编辑
摘要: import java.sql.Connection;import java.sql.SQLException;import java.beans.PropertyVetoException;import com.mchange.v2.c3p0.ComboPooledDataSource;public class Dafa { private static DBPool dbPool; private ComboPooledDataSource dataSource; static { dbPool = new DBPool(); } public ... 阅读全文
posted @ 2014-03-30 00:13 沐风山 阅读(1005) 评论(0) 推荐(0) 编辑
摘要: Java 8 正式版今天已经发布了(详情),但最常用的 Java 开发工具 Eclipse 还没有正式发布对 Java 8 的支持。不过目前可以通过更新 JDT 来支持 Java 8。步骤如下:菜单:Help > Install New Software...输入如下 URL 地址:http://build.eclipse.org/eclipse/builds/4P/siteDir/updates/4.3-P-builds按回车键选择分类 'Eclipse Java 8 Support (BETA)'为了更快速的安装,请不要选择 'Contact all upda 阅读全文
posted @ 2014-03-26 22:41 沐风山 阅读(880) 评论(0) 推荐(0) 编辑
摘要: 使用J2SE API读取Properties文件的六种方法1。使用java.util.Properties类的load()方法示例: InputStream in = lnew BufferedInputStream(new FileInputStream(name));Properties p = new Properties();p.load(in);2。使用java.util.ResourceBundle类的getBundle()方法示例: ResourceBundle rb = ResourceBundle.getBundle(name, Locale.getDefault());3。 阅读全文
posted @ 2014-03-24 18:24 沐风山 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 工作电脑常备软件QQFoxMail金山毒霸金山卫士百度云、同步盘网易云笔记Notepad+福昕阅读器搜狗输入法2345好压AcdSeeQQ音乐QQ影音有道词典迅雷精简版阿里旺旺WPSChromeFireFoxOfficeTortoiseSVNFileZilla ClientSecureCRTBC CompareAxure RPMindManagerXMindPowerDesignerJDK 7EclipseJava (+反编译插件+maven插件)EclipsePHPNavicat PremiumNetBeansToad MysqlGitHub (公司安装)需迁移的文件:QQ聊天记录Host文 阅读全文
posted @ 2014-03-24 00:06 沐风山 阅读(314) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 25 下一页