oracle 11g 及 plsqldeveloper 相关操作

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/p/2619390.html