ÔÚC#ÖÐÁ¬½ÓoracleµÄÁ¬½Ó´®Ôõôд
×î½ü¸Õ½Ó´¥oracle,Çë¸÷λ¶à¶àÖ¸½Ì¡£
ÎÒ×Ô¼ºÐ´µÄ×Ö·û´®ÊÇ
string constring = "data source=myoracle;user=sys;password=abc123;"
OracleConnection conn = new OracleConnection(constring);//½øÐÐÁ¬½Ó
conn.Open();//´ò¿ªÖ¸¶¨µÄÁ¬½Ó
ÔÚopenµÄʱºò»á²¶×½µ½´íÎóÐÅÏ¢£º¡°ORA-28009: connection to sys should be as sysdba or sysoper¡±
ÎÒÖªµÀÎÊÌâ³öÓÚûÓÐÉèÖõǽÉí·ÝΪsysdba »ò sysoper£¬µ«²»ÖªµÀÔõôÉ裬ÔÚÁ¬½Ó´®ÖÐÔõôд£¿
ÏÈллÀ²£¡
Õâ¸öÎÊÌâ:
ÎÒÀ´»Ø´ð:
ÄÚÊÂÎʰٶÈ
ÍâÊÂÎʹȸè
C# code:
using System.Data.OracleClient;using System.Data;//ÔÚ´°ÌåÉÏÌí¼ÓÒ»¸ö°´Å¥£¬½ÐButton1£¬Ë«»÷Button1£¬ÊäÈëÒÔÏ´úÂëprivate void Button1_Click(object sender, System.EventArgs e){string ConnectionString="Data Source=sky;user=system;password=manager;";//дÁ¬½Ó´®OracleConnection conn=new OracleConnection(ConnectionString);//´´½¨Ò»¸öÐÂÁ¬½Ótry{conn.Open();OracleCommand cmd=conn.CreateCommand();cmd.CommandText="select * from MyTable";//ÔÚÕâ¶ùдsqlÓï¾äOracleDataReader odr=cmd.ExecuteReader();//´´½¨Ò»¸öOracleDateReader¶ÔÏówhile(odr.Read())//¶ÁÈ¡Êý¾Ý£¬Èç¹ûodr.Read()·µ»ØÎªfalseµÄ»°£¬¾Í˵Ã÷µ½¼Ç¼¼¯µÄβ²¿ÁË odr.Close();}catch(Exception ee){Response.Write(ee.Message); //Èç¹ûÓдíÎó£¬Êä³ö´íÎóÐÅÏ¢}finally{conn.Close(); //¹Ø±ÕÁ¬½Ó}}
´ò¿ª·þÎñÆ÷¹ÜÀíÆ÷£¬
¾ÍÔÚ½
Ïà¹ØÎÊ´ð£º
£¨1£©string ConnString = "server=localhost;integrated security=sspi;database=pubs;";
£¨2£©string strConnection="user uid=sa;pwd=123456;Database=test;Server=test;Connect ......
with adod_dict do
begin
close;
commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......
oracle not available
shared memory realm does not exist
ÇëÎʸßÊÖÕâ¸öÎÊÌâÈçºÎ½â¾ö£¿
http://www.inthirties.com/thread-109-2-1.html
Ö¸¶¨ÏÂORACLE_SID,ORACLE_HOME¿´¿´£¬²»ÐоÍÓÃ1Â¥µÃ·½·¨ÁË..
cm ......
oracleÁ¬½ÓɶÕâô¸´ÔÓ°¡.
oracle 10g
ÓÃps/sql devÔõôҲÁ¬²»ÉÏ.
ÓÃsqlplus¿ÉÒԵǽ.net manager֮ǰ²âÊÔÁ¬½ÓÁ˳ɹ¦µÄ.ÏÖÔÚ¸ãµÃÒ²Á¬½Ó²»ÁË.
listener.ora:
SID_LIST_LISTENER =
(SID_LIST =
......