欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Oracle与MySQL使用区别

程序员文章站 2023-01-14 16:01:32
与MySQL通过创建不同的数据库来存储表 Oracle提出表空间(tablespace)的概念作为逻辑上的存储区域来存储表, 而不同的表空间由不同的用户来管理 用户可以授予权限或角色 举例: 使用PL/SQL Developer远程登录,使用system用户 配置文件连接的区别 applicatio ......

与MySQL通过创建不同的数据库来存储表

Oracle提出表空间(tablespace)的概念作为逻辑上的存储区域来存储表,

而不同的表空间由不同的用户来管理

用户可以授予权限或角色

举例:

使用PL/SQL Developer远程登录,使用system用户

create tablespace bosspace
datafile 'c:\bos.dbf'
size 300m
autoextend on
next 50m

create user bos identified by bos default tablespace bosspace;
--授予用户角色(不要授予dba角色),要在sys 和 system用户下操作
grant connect,resource to bos
--如果只是授予某些权限(要在sys 和 system用户下操作)
grant create session to bos


配置文件连接的区别

    <context:property-placeholder location="classpath:db.properties"/>
    <!-- dataSource数据源 -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass" value="${driverClass}"></property>
        <property name="jdbcUrl" value="${jdbcUrl}"></property>
        <property name="user" value="${user}"></property>
        <property name="password" value="${password}"></property>
    </bean>

applicationContext.xml中可以没有区别,可以把区别写在properties文件中

driverClass = oracle.jdbc.driver.OracleDriver
jdbcUrl=jdbc:oracle:thin:@192.168.189.101:1521:orcl
user=bos
password=bos
#driverClass = com.mysql.jdbc.Driver
#jdbcUrl=jdbc:mysql://localhost:3306/maven
#user=root
#password=root