oracle 11g 及 plsqldeveloper 相关操作

本文介绍在WIN7 64位系统下安装Oracle 11g的方法,并解决安装过程中遇到的问题。此外还提供了Oracle Web管理界面的访问配置、PL/SQL Developer工具的设置流程及基本的数据库操作指南。

WIN7 64位系统下安装 oracle11g 时,出现以下提示

只要把头两项人为打勾,就可以了,如下:

oracle11g 安装成功后,要想打开web管理,得先保证两个 服务必须打开,如果没开启,需手动启动:

 

oracle11g 管理界面为 web形式,如:https://机器名:1158/em 或是 https://localhost:1158/em 或是 https://127.0.0.1:1158/em

但是刚装完 oracle11g 后,这个网址是打不开的,因为需要设置 一下机器的 host 文件。

C:\Windows\System32\drivers\etc 下的 hosts 文件,找到网址,把前面的#去掉

 

PLSQLdeveloper 第一次使用,需要配置一下,不然,无法登录

工具 >> 首选项 >>

 

oracle 主目录名(自动检测为空)

OCI 库(自动检测为空)

要找到以上两项,然后,应用,确定

再启动 plsqldeveloper ,输入用户名,密码,即可登录了

 

建用户

 

 

 

建表

 

导入excel电子表格数据

 

建表空间

 

 

create tablespace guantablespace2
datafile 'D:/app/Administrator/oradata/guan/guantablespace2.def' size 500M
autoextend on next 100M maxsize unlimited logging
extent management local autoallocate
segment space management auto;

 

 protected void Button1_Click(object sender, EventArgs e)
        {
            string connstr = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["OracleConnectionString"].ConnectionString;
            OracleConnection oraConn = new OracleConnection(connstr);

            try
            {
                string sql = "select * from news";
                OracleDataAdapter myadapter = new OracleDataAdapter(sql, oraConn);
                DataSet ds = new DataSet();
                myadapter.Fill(ds);
                this.Label2.Text = ds.Tables[0].Rows[0][0].ToString();
            }
            catch (Exception ee)
            {
                this.Label1.Text = ee.ToString();
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string connstr = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["OracleConnectionString"].ConnectionString;
            OracleConnection oraConn = new OracleConnection(connstr);

            try
            {
                oraConn.Open();
                string sql = "INSERT INTO NEWS (ID,UserName,USERSEX) VALUES (SEQ1.nextval,'小东2','322')";
                OracleCommand mycomm = new OracleCommand(sql, oraConn);
                mycomm.ExecuteNonQuery();
              
            }
            catch (Exception ee)
            {
                this.Label1.Text = ee.ToString();
            }

        }

  oracle 序列的使用方法,先在库中建一个序列 SEQ1 , 然后,使用的时候,在 sql 语句中 

SEQ1.nextval

 

 string sql = "INSERT INTO NEWS (ID,UserName,USERSEX) VALUES (SEQ1.nextval,'小东2','322')";

转载于:https://www.cnblogs.com/tiger8000/archive/2012/08/02/2619390.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值