Forum Discussion

nikhil_nimbhal's avatar
nikhil_nimbhal
Occasional Contributor
11 years ago

DSN less Connectivity to Oracle database

Hi,

 

As a part of PoC , we are trying to connect to Oracle database through TestComplete. We are using TestComplete 10 Trial Version .

On trying to establish a DSN-less connection using following connection  string:



Driver=[Microsoft ODBC for Oracle]; CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP) (HOST={hostname})(PORT={portname}))(CONNECT_DATA=(SERVICE_NAME={dbname}))); uid=userid;pwd=password;

 

I get following  error when I open the connection:

 

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

 

 

While I am able to connect and retrieve data through system DSN.



Is there any method or functionality supported by TestComplete that can be implemented to form DSN less connections?

  • Hi Nikhil,

     


    According to the http://www.connectionstrings.com/oracle/ site, a connection string to the Microsoft ODBC for Oracle driver should look like this:


    Driver={Microsoft ODBC for Oracle};


    Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=199.199.199.199)(PORT=1523))(CONNECT_DATA=(SID=dbName)));


    Uid=myUsername;Pwd=myPassword;


     

  • nikhil_nimbhal's avatar
    nikhil_nimbhal
    Occasional Contributor


    Hi Tanya,



    Thanks for the reply , I have tried that as well. I am still getting the same error, i.e :



    [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

     

    While everything seems to be working fine if I use a system DSN.



    I went through another thread.  (http://smartbear.com/forums/f81/fp45/t73027/oracle-connection/) . Even there , one user has manged to connect to the database through DSN only.



    I was wondering if there s a way to establish a DSN less connection.



    Thanks,

    Nikhil


  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 3 rankChampion Level 3
    Hi Nikhil,



    a) TestComplete is 32-bit application (though it can drive 64-bit ones as well) and thus can use only 32-bit ODBC/OLEDB drivers which, in their turn can work only with 32-bit DSNs (if needed). So ensure that the driver that you are trying to use is 32-bit one;



    b) Can you post here the code that gives you problem?
  • nikhil_nimbhal's avatar
    nikhil_nimbhal
    Occasional Contributor
    Hi Alexei,



    Sorry for delayed response. Following are the information you requested:



    a) TestComplete is 32-bit application (though it can drive 64-bit ones as well) and thus can use only 32-bit ODBC/OLEDB drivers which, in their turn can work only with 32-bit DSNs (if needed). So ensure that the driver that you are trying to use is 32-bit one



    I am able to make the connection and execute queries , if DSN is configured. That is not  an issue.





    b) Can you post here the code that gives you problem?



    The problem stems from the requirement of creating DSN-less connection through testcomplete. As I want to run my tests on various machine . I do not wish to manually configure DSN on each machine.



    On trying different connection strings as posted above, I always get the error :



    Data source name not found and no default driver is specified.





    Please see the following code :



    AConnection = Sys["OleObject"]("ADODB.Connection");



    AConnection["ConnectionString"]=Driver=[Microsoft ODBC for Oracle]; CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP) (HOST={hostname})(PORT={portname}))(CONNECT_DATA=(SERVICE_NAME={dbname}))); uid=userid;pwd=password;




     AConnection["Open"]();





    Now I have also used SID instead of Service name but I still get the same error.



    Any help in the mattter will be appreciated.



    Thanks,

    Nikhil



  • nikhil_nimbhal's avatar
    nikhil_nimbhal
    Occasional Contributor
    Hi,



    Just an update ,  I was able to make a DSN-less connection using ActiveX object instead of OleObject. Rest of the connection string was same



    Regards,

    NIkhil