Oracle Database Connection

Source: Internet
Author: User
Tags odbc oracleconnection oracle database
oracle| Data | database | database connection ODBC


New 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; "


OLE DB, OleDbConnection (. NET)


Standard Security:
"Provider=msdaora;data Source=myoracledb; User Id=username; PASSWORD=ASDASD; "
This one's from Microsoft, the following are from Oracle
Standard Security:
"Provider=oraoledb.oracle;data Source=myoracledb; User Id=username; PASSWORD=ASDASD; "


Trusted Connection:
"Provider=oraoledb.oracle;data source=myoracledb;osauthent=1;"


OracleConnection (. NET)


Standard:
"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:
"PROVIDER=MSDATASHAPE.1; Persist security info=false;data provider=msdaora;data source=orac;user ID=USERNAME;PASSWORD=MYPW "






Example 1:namespace Oracle
{
<summary>
Summary description of the WebForm1.
</summary>
public class WebForm1:System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
Private DataSet myDataSet = new DataSet ();
private void Page_Load (object sender, System.EventArgs e)
{
Place user code here to initialize page

String connstring= "Provider=oraoledb.oracle;data source=jtest; User Id=system; Password=manager; ";
OleDbConnection conn=new OleDbConnection (connstring);
String 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 ();

}





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.