首页 > 数据库 > Oracle > 正文

Oracle数据库连接

2024-08-29 13:46:16
字体:
来源:转载
供稿:网友
 odbc



ew version:

driver={microsoft odbc for Oracle};server=oracleserver.world;uid=username;pwd=asdasd;



old version:

driver={microsoft odbc driver for oracle};connectstring=oracleserver.world;uid=myusername;pwd=mypassWord;



oledb, oledbconnection (.net)



tandard security:

rovider=msdaora;data source=myoracledb;user id=username;password=asdasd;

this ones from microsoft, the following are from oracle

tandard security:

rovider=oraoledb.oracle;data source=myoracledb;user id=username;password=asdasd;



trusted connection:

rovider=oraoledb.oracle;data source=myoracledb;osauthent=1;



oracleconnection (.net)



tandard:

data source=oracle8i;integrated security=yes;

this one works only with oracle 8i release 3 or later

declare the oracleconnection:

c#:

using system.data.oracleclient;

oracleconnection ooracleconn = new oracleconnection();

ooracleconn.connectionstring = my connectionstring;

ooracleconn.open();

vb.net:

imports system.data.oracleclient

dim ooracleconn as oracleconnection = new oracleconnection()

ooracleconn.connectionstring = my connectionstring

ooracleconn.open()



data shape



ms data shape:

rovider=msdatashape.1;persist security info=false;data PRovider=msdaora;data source=orac;user id=username;password=mypw







例子1:namespace oracle

{

///

/// webform1 的摘要说明。

///


ublic class webform1 : system.web.ui.page

{

rotected system.web.ui.webcontrols.datagrid datagrid1;

rivate dataset mydataset = new dataset();

rivate void page_load(object sender, system.eventargs e)

{

// 在此处放置用户代码以初始化页面

tring connstring=provider=oraoledb.oracle;data source=jtest;user id=system;password=manager;;

oledbconnection conn=new oledbconnection(connstring);

tring strcom = select * from system.lg_task_table;

conn.open();

oledbdataadapter mycommand = new oledbdataadapter(strcom,conn);

mycommand.fill(mydataset,system.lg_task_table);

datagrid1.datasource = mydataset.tables[system.lg_task_table].defaultview;

datagrid1.databind();

conn.close();

}





发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表