通常,术语"oracle数据库"既用来指存储在硬盘上的内部存有数据的数据库文件,也指用来管理这些文件的内存结构.事实上,术语"数据库"归属于数据文件,而实例则归属于内存结构.
一个实例由SGA(system global area)以及一系列后台进程组成.每一个连接到数据库的用户都是通过一个客户端进程来进行管理的.客户端进程与服务器进程是相联结的,每一个服务器进程都会被分配一块私有的内存区域.称为PGA(process global area).
oracle安装在windows,提示要装.netframework,装好后,感觉就慢了很多.不是需要,闲着装这毛就是找麻烦,相对于装在redhat就方便多了.还是mysql方便...
顺便记一下oracle的spring开发连接配置.
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${db.driverClass}" />
<property name="jdbcUrl" value="${db.jdbcUrl}" />
<property name="user" value="${db.user}" />
<property name="password" value="${db.password}" />
<property name="minPoolSize" value="1" />
<property name="maxPoolSize" value="300" />
<property name="maxIdleTime" value="60" />
<property name="acquireIncrement" value="5" />
<property name="idleConnectionTestPeriod" value="60" />
</bean>
db.driverClass=oracle.jdbc.driver.OracleDriver
db.jdbcUrl=jdbc:oracle:thin:@192.168.0.119:1521:ora10g
db.user=mks
db.password=mks
----------也顺便记一下h2嵌入式内存数据库---------------
0.pom.xml
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.163</version>
<scope>runtime</scope>
</dependency>
1.web.xml
<servlet>
<servlet-name>h2</servlet-name>
<servlet-class>org.h2.server.web.WebServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>h2</servlet-name>
<url-pattern>/admin/h2/*</url-pattern>
</servlet-mapping>
2.applicationContext.xml
<jdbc:embedded-database id="dataSource" type="H2">
<jdbc:script location="classpath:/database/h2/calendar-schema.sql"/>
<jdbc:script location="classpath:/database/h2/calendar-data.sql"/>
</jdbc:embedded-database>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
p:dataSource-ref="dataSource"/>
<bean id="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate"
p:dataSource-ref="dataSource"/>
3.
calendar-schema.sql
create table calendar_users (
id bigint identity,
email varchar(256) not null unique,
password varchar(256) not null,
first_name varchar(256) not null,
last_name varchar(256) not null
);
create table events (
id bigint identity,
when timestamp not null,
summary varchar(256) not null,
description varchar(500) not null,
owner bigint not null,
attendee bigint not null,
FOREIGN KEY(owner) REFERENCES calendar_users(id),
FOREIGN KEY(attendee) REFERENCES calendar_users(id)
);
calendar-data.sql
insert into calendar_users(id,email,password,first_name,last_name) values (0,'user1@example.com','user1','User','1');
insert into calendar_users(id,email,password,first_name,last_name) values (1,'admin1@example.com','admin1','Admin','1');
insert into calendar_users(id,email,password,first_name,last_name) values (2,'user2@example.com','user2','User','2');
insert into events (id,when,summary,description,owner,attendee) values (100,'2013-10-04 20:30:00','Birthday Party','This is going to be a great birthday',0,1);
insert into events (id,when,summary,description,owner,attendee) values (101,'2013-12-23 13:00:00','Conference Call','Call with the client',2,0);
insert into events (id,when,summary,description,owner,attendee) values (102,'2014-01-23 11:30:00','Lunch','Eating lunch together',1,2);