Results 1 to 1 of 1
  1. #1
    Join Date
    May 2003
    Posts
    12

    Question Unanswered: ADO connection to Image database

    Hello. I am changing my DAO connection to ADO connection in my VB application and I need some advise on what to write. My current connection is made as follows and it works:

    Code:
    Global wrk1 As Workspace 
    Global con1 As Connection 
    Dim sDsn As String 
    
    sDSN = "SOTK" 
    
    ' Create connection to SOT system 
    Set wrk1 = CreateWorkspace("ODBCSOT", "admin", "", dbUseODBC) 
    wrk1.DefaultCursorDriver = dbUseODBCCursor 
    Set con1 = wrk1.OpenConnection("ODBCSot", dbDriverNoPrompt, True, "ODBC;DATABASE=" & sDsn & ";DSN=" & sDsn) 
    
    SQL = "SELECT * FROM DBVSTO.ALUSTA WHERE ALU_TYYPPI = 'C' " 
    SQL = SQL & " AND ALU_VARUSTAMO NOT IN ('STEV','EGON') AND " 
    SQL = SQL & " ALU_VARASTO <> 'RC'" 
    
    Set rs = con1.OpenRecordset(SQL, dbOpenSnapshot, dbExecDirect)
    However, I want to make it to work through ADO, not DAO. How do I do it?

    I have figured that it has bo be something like this:

    Code:
    Dim gKONRAPRecordset As New ADODB.Recordset 
    
    SQL = "SELECT * FROM DBVSTO.ALUSTA WHERE ALU_TYYPPI = 'C' " 
    SQL = SQL & " AND ALU_VARUSTAMO NOT IN ('STEV','EGON') AND " 
    SQL = SQL & " ALU_VARASTO <> 'RC'" 
    
    Set gKONRAPRecordset = New ADODB.Recordset 
    gKONRAPRecordset.ActiveConnection = "Provider=MSDAORA;Data Source=SOTK;User Id=admin;" 
        
    gKONRAPRecordset.Open SQL

    The problem is that Provider is not MSDAORA, but something else. I could not find any reference from the net what I should write into that. The database behind is old IMAGE database. Of course, I have all the necessary ADO references and components in my project.

    My ODBC driver is as follows:

    ODBC-driver: ODBCLink/SE-32 Driver
    Data Source Name SOTK
    DataBase Name TilasDBE.FILEK
    Server Name HP13
    Server Type MPE/iX
    Session ID MHU
    User Name MGR
    Acct Name JORA
    Group Name FILEK

    Whe I execute my new code, it gives me following error:

    ORA-12154 TNS: Could not resolve service name

    This would suggest it tries to read my Oracle connection (I have ODBC connection to Oracle database also), but that is not what I need in this. It should use that ODBCLink/SE-32 Driver connection. Any help appreciated.
    Last edited by Karibu; 05-12-03 at 08:41.
    ------------------------------------
    Long days and pleasant nights
    - Roland the gunslinger
    ------------------------------------

Posting Permissions

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