Forum Discussion

AKarandjeff's avatar
AKarandjeff
Contributor
14 years ago

Oracle ADO Connection String

I am trying to connect to an Oracle 11g database in TestComplete using the ADO components and am hitting an error on Open that states "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".  I have set up an ODBC connection (in attachment) and it tests successfully. When you lok at the driver name, it says "Oracle in OraClient11g_home1," so that is what I've been using for the Driver variable in the connection string.  I've tried a variety of connection string types based on using ADO in other applications, but none seem to work.  One example is below.  I'm also including my TNSNAMES entry for the database.  I have tried the IP address for the host, as well as the host name itself.  Thanks.  

 

  var AConnection, RecSet;

  // Create a Connection object

  AConnection = ADO.CreateADOConnection();

  // Specify the connection string

  AConnection.ConnectionString = "Driver={Oracle in OraClient11g_home1};dbq=bluff:1521/DEVC11G;UId=user;Pwd=password;";

  // Suppress the login dialog box

  AConnection.LoginPrompt = false;

  AConnection.Open();





DEVC11G =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = bluff)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = DEVC11G)

    )

4 Replies

  • To add to this, I'm planning on using the Oracle tables for DDT, primarily for performing data fill operations (at least initially). Thanks.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Since you're planning on using the Oracle tables as feeding in for DDT, I would suggest, instead of using the ADO objects, take a look at using the DDT.ADODriver (see http://smartbear.com/support/viewarticle/13411/).



    Of course, using that, you'd still need to make sure you have the proper connection string defined.  I'm guessing that your problem is somewhere in your connection string.  Unfortunately, I'm not familiar enough with Oracle (actually, not really familiar at all) to give any informed answer as to what your problem is.



    Edit:  A quick google search found this:  http://itknowledgeexchange.techtarget.com/itanswers/how-to-connect-vb60-to-oracle11g/



    It kind of looks like, once you have the Oracle client stuff installed, you should be able to use a connection string like



    "Driver={Microsoft ODBC for Oracle};Server=bluff:1521/DEVC11G; Uid=your_username;Pwd=your_password;"




  • I was apparently (*as is oft the case*) over thinking things and was under the impression that I had to be specific as to the type of ODBC driver being used.  I changed the driver parameter from what was appearing as the driver type in the ODBC (the oraClient11g_home) with just "Microsoft ODBC for Oracle" (because it can't be that generic, can it?) and it worked perfectly.  Again as a mea culpa, I thought you had to be specific about the driver.  I'll also take your suggestion about using the DDT.ADOdriver.  I was just trying to get the connection stuff working before I started in on acutally using it in a DDT.  Thanks!
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Guilty as charged when it comes to over thinking.  Glad it's working for you now.  Let me know if you need any assistance in figuring out the whole ADODriver thing.