??xml version="1.0" encoding="utf-8" standalone="yes"?>av毛片在线免费看,久久久av电影,欧美男男激情freegay http://www.aygfsteel.com/alexwan/archive/2008/09/12/228544.htmlAlexwan Alexwan Fri, 12 Sep 2008 03:20:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/09/12/228544.html http://www.aygfsteel.com/alexwan/comments/228544.html http://www.aygfsteel.com/alexwan/archive/2008/09/12/228544.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/228544.html http://www.aygfsteel.com/alexwan/services/trackbacks/228544.html
可以在sqlplus中用以下命?l表I间d数据文g:
alter tablespace tablespaceName add datafile filePath size 500m;
]]> [hibernate]hibernate中自定义主键生成?/title> http://www.aygfsteel.com/alexwan/archive/2008/09/02/226316.htmlAlexwan Alexwan Tue, 02 Sep 2008 03:59:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/09/02/226316.html http://www.aygfsteel.com/alexwan/comments/226316.html http://www.aygfsteel.com/alexwan/archive/2008/09/02/226316.html#Feedback 8 http://www.aygfsteel.com/alexwan/comments/commentRss/226316.html http://www.aygfsteel.com/alexwan/services/trackbacks/226316.html 背景:
Hibernate(目前使用的版本是3.2)中提供了多种生成主键的方?在下面的文章中有列出?br />
[hibernate]Hibernate主键生成方式 Key Generator
然而当前的q么多种生成方式未必能满x们的要求.
比如increment ,可以在一个hibernate实例的应用上很方便的时?但是在集的时候就不行?
再如 identity ,sequence ,native 是数据局提供的主键生成方?往往也不是我们需?而且在程序跨数据库方面也体现Z?
q有Z法的生成方式生成出来的主键基本都是字符串的.
我们现在需要一U生成方?使用Long作ؓ主键cd,自动?支持集群.
那么我们需要自定义一个我们的主键生成器才能实C.
实现代码 :
package hibernate;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.id.Configurable;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.PersistentIdentifierGenerator;
import org.hibernate.type.Type;
public class IncrementGenerator implements IdentifierGenerator, Configurable {
private static final Log log = LogFactory.getLog(IncrementGenerator. class );
private Long next;
private String sql;
public Serializable generate(SessionImplementor session, Object object)
throws HibernateException {
if (sql != null ) {
getNext( session.connection() );
}
return next;
}
public void configure(Type type, Properties params, Dialect d) throws MappingException {
String table = params.getProperty( " table " );
if (table == null ) table = params.getProperty(PersistentIdentifierGenerator.TABLE);
String column = params.getProperty( " column " );
if (column == null ) column = params.getProperty(PersistentIdentifierGenerator.PK);
String schema = params.getProperty(PersistentIdentifierGenerator.SCHEMA);
sql = " select max( " + column + " ) from " + ( schema == null ? table : schema + ' . ' + table );
log.info(sql);
}
private void getNext(Connection conn) throws HibernateException {
try {
PreparedStatement st = conn.prepareStatement(sql);
ResultSet rs = st.executeQuery();
if ( rs.next() ) {
next = rs.getLong( 1 ) + 1 ;
}
else {
next = 1l ;
}
}catch (SQLException e)
{
throw new HibernateException(e);
}
finally {
try {
conn.close();
} catch (SQLException e)
{
throw new HibernateException(e);
}
}
}
}
配置:
在对应的hbm文g里面id的配|如?
< id name ="id" type ="long" column ="id" >
< generator class ="hibernate.IncrementGenerator" />
</ id >
ps:此生成方式仅通过两个hibernate实例试,如发现有问题,La.
]]> [hibernate]Hibernate主键生成方式 Key Generator http://www.aygfsteel.com/alexwan/archive/2008/09/02/226299.htmlAlexwan Alexwan Tue, 02 Sep 2008 03:24:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/09/02/226299.html http://www.aygfsteel.com/alexwan/comments/226299.html http://www.aygfsteel.com/alexwan/archive/2008/09/02/226299.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/226299.html http://www.aygfsteel.com/alexwan/services/trackbacks/226299.html
主键产生?
可选项说明Q?
1) assigned
主键由外部程序负责生成,无需Hibernate参与?
2) hilo
通过hi/lo 法实现的主键生成机Ӟ需要额外的数据库表保存?
键生成历史状态?
3) seqhilo
与hilo cMQ通过hi/lo 法实现的主键生成机Ӟ只是主键历史
状态保存在Sequence中,适用于支持Sequence的数据库Q如Oracle?
4) increment
主键按数值顺序递增。此方式的实现机制ؓ在当前应用实例中l持
一个变量,以保存着当前的最大|之后每次需要生成主键的时?
此值加1作ؓ主键?
q种方式可能产生的问题是Q如果当前有多个实例讉K同一个数?
库,那么׃各个实例各自l护主键状态,不同实例可能生成同样
的主键,从而造成主键重复异常。因此,如果同一数据库有多个?
例访问,此方式必避免用?
5) identity
采用数据库提供的主键生成机制。如DB2、SQL Server、MySQL
中的主键生成机制?
6) sequence
采用数据库提供的sequence 机制生成主键。如Oralce 中的
Sequence?
7) native
由HibernateҎ底层数据库自行判断采用identity、hilo、sequence
其中一U作Z键生成方式?
8) uuid.hex
由HibernateZ128 位唯一g生算法生?6 q制数|~码?
以长?2 的字W串表示Q作Z键?
9) uuid.string
与uuid.hex cMQ只是生成的主键未进行编码(长度16Q。在某些
数据库中可能出现问题Q如PostgreSQLQ?
10) foreign
使用外部表的字段作ؓ主键?
一般而言Q利用uuid.hex方式生成主键提供最好的性能和数据库q_?
应性?
另外׃常用的数据库Q如Oracle、DB2、SQLServer、MySql {,都提
供了易用的主键生成机ӞAuto-Increase 字段或者SequenceQ。我们可以在?
据库提供的主键生成机制上Q采用generator-class=native的主键生成方式?
不过值得注意的是Q一些数据库提供的主键生成机制在效率上未必最佻I
大量q发insert数据时可能会引v表之间的互锁?
数据库提供的主键生成机制Q往往是通过在一个内部表中保存当前主键状
态(如对于自增型主键而言Q此内部表中q护着当前的最大值和递增量)Q?
之后每次插入数据会读取这个最大|然后加上递增量作为新记录的主键,?
后再把这个新的最大值更新回内部表中Q这P一ơInsert操作可能D数据
库内部多ơ表d操作Q同时伴随的q有数据的加锁解锁操作,q对性能产生
了较大媄响?
因此Q对于ƈ发Insert要求较高的系l,推荐采用uuid.hex 作ؓ主键生成
机制?nbsp;
]]> [ORACLE]ORACLE中表I间的?/title> http://www.aygfsteel.com/alexwan/archive/2008/08/26/224439.htmlAlexwan Alexwan Tue, 26 Aug 2008 03:51:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/08/26/224439.html http://www.aygfsteel.com/alexwan/comments/224439.html http://www.aygfsteel.com/alexwan/archive/2008/08/26/224439.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/224439.html http://www.aygfsteel.com/alexwan/services/trackbacks/224439.html 表空间的作用之一是在一个ORACLE应用中开辟一个领域让指定用户的数据表区别于其他用L数据?q也方便用户Ҏ据表的管?同时也方便了对ORACLE服务的管?节省计算?
要达到这个目标通常要给用户讄一个默认的表空?以下是其中一U实现方?步骤如下:
步骤是:
1Q创Z个表I间,在sqlplus下用如下参考命?
create tablespace data datafile '/home/oracle/databases/ora10/data .dbf'
size 200M
autoextend on maxsize 200M
extent management local uniform size 64K;
2Q创Z个用P该用户默认的表空间ؓ刚刚创徏的表I间Q时表I间为TEMP,参考如下命?
create user userName identified by password DEFAULT TABLESPACE tablespaceName TEMPORARY TABLESPACE temptablespaceName;
3Q以q个用户名和密码q进d是另一个用户对应的数据库表I间?
]]>[ORACLE]linux下开启ORACLE服务的步?/title> http://www.aygfsteel.com/alexwan/archive/2008/08/26/224434.htmlAlexwan Alexwan Tue, 26 Aug 2008 03:32:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/08/26/224434.html http://www.aygfsteel.com/alexwan/comments/224434.html http://www.aygfsteel.com/alexwan/archive/2008/08/26/224434.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/224434.html http://www.aygfsteel.com/alexwan/services/trackbacks/224434.html
1Q以oraclew䆾q入 su oracle
2Q进入oraproduct/bin目录
3Q执行启动监听命令:./lsnrctl start
4Q修改当前要启动的SID|export ORACLE_SID=dbname
(要查看可用的数据库实?在oraproduct/ dbs目录下面。LS一下看看所有扩展名?ora的就可以?
5Q以NOLOG方式q接数据库:./sqlplus /nolog
6Q再q接到sysdbaQconnect /as sysdba
7Q执行启动命令:startup
PS:前三步只执行一?后四步可重复执行.
在此感谢杨秧同志的热心帮?
]]> 从SQLSERVER与ORACLE数据库中随机取记?/title> http://www.aygfsteel.com/alexwan/archive/2008/08/21/223551.htmlAlexwan Alexwan Thu, 21 Aug 2008 08:53:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/08/21/223551.html http://www.aygfsteel.com/alexwan/comments/223551.html http://www.aygfsteel.com/alexwan/archive/2008/08/21/223551.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/223551.html http://www.aygfsteel.com/alexwan/services/trackbacks/223551.html 在sql server?从数据表中随机取出n条记?使用以下SQL语句:
select top n * from tableName order by newid ()
在oralce?从数据表中随机取出n条记?使用以下SQL语句
select * from ( select tableName . * ,dbms_random.random as randomKey from tableName order by randomKey)
where rownum <= n
]]> [oracle]oracle中创I间(tablespace) http://www.aygfsteel.com/alexwan/archive/2008/08/16/222419.htmlAlexwan Alexwan Sat, 16 Aug 2008 05:51:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/08/16/222419.html http://www.aygfsteel.com/alexwan/comments/222419.html http://www.aygfsteel.com/alexwan/archive/2008/08/16/222419.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/222419.html http://www.aygfsteel.com/alexwan/services/trackbacks/222419.html
create tablespace data datafile '/home/oracle/databases/ora10/data .dbf'
size 100M
autoextend on maxsize 200M
extent management local uniform size 64K;
ps:需要确?'/home/oracle/databases/ora10/data .dbf' 中涉及到的文件夹存在,q且oralce用户有写的权?
]]> [oracle]cd转换之字W串转成旉 http://www.aygfsteel.com/alexwan/archive/2008/07/14/214689.htmlAlexwan Alexwan Mon, 14 Jul 2008 03:59:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/07/14/214689.html http://www.aygfsteel.com/alexwan/comments/214689.html http://www.aygfsteel.com/alexwan/archive/2008/07/14/214689.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/214689.html http://www.aygfsteel.com/alexwan/services/trackbacks/214689.html
select to_timestamp('2003-12-19 00:00:00','yyyy-mm-dd hh24:mi:ss') from dual
]]> [oracle]sqlplus创徏用户q授?/title> http://www.aygfsteel.com/alexwan/archive/2008/07/14/214686.htmlAlexwan Alexwan Mon, 14 Jul 2008 03:40:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/07/14/214686.html http://www.aygfsteel.com/alexwan/comments/214686.html http://www.aygfsteel.com/alexwan/archive/2008/07/14/214686.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/214686.html http://www.aygfsteel.com/alexwan/services/trackbacks/214686.html sqlplus 下用命令:
create user username identified by pwd;
grant connect,resource,dba to username;
]]> [pgsql]linux下开启postgres sql数据库服务器命o http://www.aygfsteel.com/alexwan/archive/2008/07/11/214337.htmlAlexwan Alexwan Fri, 11 Jul 2008 13:33:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/07/11/214337.html http://www.aygfsteel.com/alexwan/comments/214337.html http://www.aygfsteel.com/alexwan/archive/2008/07/11/214337.html#Feedback 1 http://www.aygfsteel.com/alexwan/comments/commentRss/214337.html http://www.aygfsteel.com/alexwan/services/trackbacks/214337.html
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 & Q开PGQ?br />
exit (恢复为root)
]]> [oracle]linux下启动DataBase Configuration assistant http://www.aygfsteel.com/alexwan/archive/2008/07/10/213991.htmlAlexwan Alexwan Thu, 10 Jul 2008 07:45:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/07/10/213991.html http://www.aygfsteel.com/alexwan/comments/213991.html http://www.aygfsteel.com/alexwan/archive/2008/07/10/213991.html#Feedback 1 http://www.aygfsteel.com/alexwan/comments/commentRss/213991.html http://www.aygfsteel.com/alexwan/services/trackbacks/213991.html
./DBCA
Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-
没想到那么简单!Q?
]]> pl/sqlҎ据表加锁的现?/title> http://www.aygfsteel.com/alexwan/archive/2008/07/09/213538.htmlAlexwan Alexwan Wed, 09 Jul 2008 02:19:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/07/09/213538.html http://www.aygfsteel.com/alexwan/comments/213538.html http://www.aygfsteel.com/alexwan/archive/2008/07/09/213538.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/213538.html http://www.aygfsteel.com/alexwan/services/trackbacks/213538.html
Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-
一开始我也觉得很奇怪,无意中发现的现象Q也没有特别的去查资料,应该q有其他形式的加锁方式吧Q?
]]> [oracle]ORA-01460: 转换h无法实现或不合理 http://www.aygfsteel.com/alexwan/archive/2008/07/09/213508.htmlAlexwan Alexwan Wed, 09 Jul 2008 01:32:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/07/09/213508.html http://www.aygfsteel.com/alexwan/comments/213508.html http://www.aygfsteel.com/alexwan/archive/2008/07/09/213508.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/213508.html http://www.aygfsteel.com/alexwan/services/trackbacks/213508.html 一开始以为是~码或者字W集的问题,后来才发现是数据库类型的长度不够Q?br />
类型从nvarchar2(2000)换成clob好?br />
如果要在Hibernate上用clob像用string那么方便需要spring的辅助!
]]> [oracle]oracle字符?~码方式问题 http://www.aygfsteel.com/alexwan/archive/2008/07/08/213294.htmlAlexwan Alexwan Tue, 08 Jul 2008 04:41:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/07/08/213294.html http://www.aygfsteel.com/alexwan/comments/213294.html http://www.aygfsteel.com/alexwan/archive/2008/07/08/213294.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/213294.html http://www.aygfsteel.com/alexwan/services/trackbacks/213294.html
[A]数据库服务器字符集select * from nls_database_parametersQ其来源于props$Q是表示数据库的字符集?
客户端字W集环境select * from nls_instance_parameter,其来源于v$parameterQ?
表示客户端的字符集的讄Q可能是参数文gQ环境变量或者是注册?nbsp;
会话字符集环? select * from nls_session_parameterQ其来源于v$nls_parametersQ表CZ话自q讄Q可能是会话的环境变量或者是alter session完成Q如果会话没有特D的讄Q将与nls_instance_parameter一致?nbsp;
客户端的字符集要求与服务器一_才能正确昄数据库的非Ascii字符。如果多个设|存在的时候,alter session>环境变量>注册?gt;参数文g
字符集要求一_但是语言讄却可以不同,语言讄用英文。如字符集是zhs16gbkQ则nls_lang可以是American_America.zhs16gbk?
HKEY_LOCAL_MACHINE-->SOFTWARE-->ORACLE-->HOME0
修改为nls_lang=AMERICAN_AMERICA.UTF-8
]]> oracle使用exp导出数据库数?/title> http://www.aygfsteel.com/alexwan/archive/2008/07/04/212646.htmlAlexwan Alexwan Fri, 04 Jul 2008 08:59:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/07/04/212646.html http://www.aygfsteel.com/alexwan/comments/212646.html http://www.aygfsteel.com/alexwan/archive/2008/07/04/212646.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/212646.html http://www.aygfsteel.com/alexwan/services/trackbacks/212646.html EXP 用户?密码Q服务名 full=y/n file=c:\ss.dmp
ps:服务名指的是在客L|络理(net manager)中设|的服务名称
]]> 关于pl/sql登陆oracle 10g时发生的错误:ORA-12541:TNS:没有监听?/title> http://www.aygfsteel.com/alexwan/archive/2008/06/28/211332.htmlAlexwan Alexwan Sat, 28 Jun 2008 08:03:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/06/28/211332.html http://www.aygfsteel.com/alexwan/comments/211332.html http://www.aygfsteel.com/alexwan/archive/2008/06/28/211332.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/211332.html http://www.aygfsteel.com/alexwan/services/trackbacks/211332.html
windows:开?>控制面板=>性能和维?>理工具=>服务
然后后按名称排序查找名称为OracleOraDb10g_home1TNSListener,如果它的状态ؓI的,那么启动?如果状态已l是启动?q是报这个错,是别的问题了吧!
另外q没有尝试在其他操作pȝ下安装和q行qoracle,不过怿只要知道是因为服务没开启引L?那么可以找到解决的办法?
]]> oracle数据恢复命o http://www.aygfsteel.com/alexwan/archive/2008/06/27/211009.htmlAlexwan Alexwan Fri, 27 Jun 2008 01:35:00 GMT http://www.aygfsteel.com/alexwan/archive/2008/06/27/211009.html http://www.aygfsteel.com/alexwan/comments/211009.html http://www.aygfsteel.com/alexwan/archive/2008/06/27/211009.html#Feedback 0 http://www.aygfsteel.com/alexwan/comments/commentRss/211009.html http://www.aygfsteel.com/alexwan/services/trackbacks/211009.html ]]>
վ֩ģ壺
ͬ |
|
տ |
ƽ |
|
ɽ |
ʯ̨ |
Ƥɽ |
̫ |
|
|
ѭ |
|
Ȫ |
½ |
˼é |
ɽ |
ɽ |
|
ƽ |
ӱ |
|
Ϫ |
|
ƽ |
Ϫ |
|
|
Ϫ |
³ |
|
|
ˮ |
Ϋ |
|
Ž |
ɽ |
˳ |
ʯ |
ƽ |
ͼ |