Results 1 to 11 of 11

Thread: Oracle's OLEDB Provider ?

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    12

    Oracle's OLEDB Provider ?

    Hi,

    Im new in VB/Oracle development and I just want to know where I can get Oracle's OLEDB Provider (OraOLEDB)? Im currently using Microsoft OLEDB Provider for Oracle (MSORA).

    BTW, how do i access / manipulate data in Oracle using this method? do i use the Execute method?

    Thanks

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    India
    Posts
    342
    VB Code:
    1. Dim con As ADODB.Connection
    2. Dim rs As ADODB.Recordset
    3.  
    4. Set con = New ADODB.Connection
    5. Set rs = New ADODB.Recordset
    6.  
    7. con.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=scott;Password=Tiger;Data Source=ksmdsn"
    8. ''give your DSN name instead of ksmdsn for 'Data Source'
    9. con.Open
    10. rs.CursorLocation = adUseClient
    11. rs.Open "select * from t_person ", con
    12. MsgBox rs.RecordCount

    u can also use con.Execute method to Execute your Queries.
    ksm

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    12

    Insert, Update & Delete in VB on Oracle

    Thanks Kunchesm. Can you post some code on how to Insert, Update & Delete row in Oracle using ADO code / Exceute method?

    How do I enable Transaction Procesing? Commit & Rollback?

    Thanks

  4. #4
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    India
    Posts
    342
    VB Code:
    1. con.Open
    2. eno=1
    3. ename="test1"
    4. '' Replace t_person with ur table name and eno, ename with fields in ur table.
    5. strSql= "insert into t_person values(" & eno & ",'" & ename & "') "  ''for Inserting
    6. strSql = "update t_person set ename='" & ename & "' where eno=" & eno ''for updating
    7. strSql = "delete from  t_person set ename='" & ename & "' where eno=" & eno ''for Deleting
    8. con.Execute strSql '' strSql contains the SQL Query for insert or updaet or delete
    ksm

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    12
    Thanks so much Kunchesm for your help. BTW, how do issue commit & Rollback? do i use the BeginTrans... commit of VB or issue COMMIT as an SQL and use the Execute method? Thanks in advance.

  6. #6
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Originally posted by theMaverick
    Thanks so much Kunchesm for your help. BTW, how do issue commit & Rollback? do i use the BeginTrans... commit of VB or issue COMMIT as an SQL and use the Execute method? Thanks in advance.
    Without a commit your inserts will be lost in Oracle rollback segments. I suggest that you use the connection object to control the transaction.

    For instance if adoCn is your connection object then
    VB Code:
    1. adoCn.BeginTrans
    2.     --Use your insert / update / delete statements
    3. adoCn.CommitTrans
    4.  
    5. In case of any error you could revert to
    6. adoCn.RollbackTrans
    Cheers!
    Abhijit
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  7. #7

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    12
    Thanks for your answers. but w/c is better/faster in terms of system performance? issue COMMIT as and SQL statement using the Excute Method or using BeginTrans, CommitTrans & RolbackTrans?

  8. #8
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    In my experience, i have found the adoCn.CommitTrans to be slightly faster.

    Again, the committing doesn't take much time, cos the database requires only a flag to be changed. The record insert has already taken place by then.

    Its a rollback which usually takes time.

    Another advice, if you want your inserts to be really fast, do not issue them against a connection object.

    adoCn.Execute ('insert into')

    Instead use command-objects with parameters and bind variables. This is highly scalable, which is what you want Oracle to be. Example
    VB Code:
    1. adoCmd.CommandType = adcmdtext
    2. adoCmd.Commandtext = "Insert into table values(?,?)"
    3. adoCmd.Parameters.Append adoCmd.CreateParameter("p0",advarchar,"hello")
    4. adoCmd.Parameters.Append adoCmd.CreateParameter("p1",advarchar,"world")
    5. adoCmd.Execute

    Cheers,
    Abhijit
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  9. #9

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    12
    Many Thanks abhijit.

    based on your advise, can i also assume that Updates & Deletes are faster using ADO's Command object?

  10. #10
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Originally posted by theMaverick
    Many Thanks abhijit.

    based on your advise, can i also assume that Updates & Deletes are faster using ADO's Command object?
    YES
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  11. #11

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    12
    Hi do you suggest using Data Environment Designer in developing VB app on Oracle backend? any known issues on this?

    Another thing, is it advisable to use AddNew, Update (etc ...) methods instead of executing SQL statements on Connection & Command objects? or AddNew, Update (etc...) methods are not available in Oracle OLEDB providers?

    Many Thanks
    Last edited by theMaverick; Feb 23rd, 2003 at 09:28 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width