7 Replies Latest reply: Jan 17, 2013 5:38 AM by 975714 RSS

    Oracle Connection problem: Unable to open library

    975714
      Hi,

      I'm using VS2010, Timesten 112241 and ODAC 1120320 on Windows 7. When I try to access TT database using SQL Developer, for example, it works perfectly fine, but whatever I try to access it from my application it throws ORA-29158: Unable to open library exception. I've read few threads on forum about this problem, tried to copy tnsnames.ora and sqlnet.ora to folder of new client after installing ODP, set TNS_ADMIN to locations of .ora files, set tns alias, but nothing seems to work. Which library it references? What am I missing?

      Here is the output of ttVersion:
      TimesTen Release 11.2.2.4.1 (64 bit NT) (tt1122_64:53396) 2012-10-30T06:32:14Z
      Instance admin: nikola.bajic
      Instance home directory: C:\TimesTen\TT1122~1\
      World accessible
      Daemon home directory: C:\TimesTen\TT1122~1\srv\info
      PL/SQL enabled.

      Here is the output of ttStatus:
      Daemon pid 1872 port 53396 instance tt1122_64
      TimesTen server pid 1960 started on port 53397
      Data store c:\tt_temp\TT_ItemCache
      There are no connections to the data store
      Replication policy : Manual
      Cache Agent policy : Manual
      PL/SQL enabled.
      Data store c:\users\nikola~1.baj\appdata\roaming\timesten\demoda~1\TT_tt1122_64
      There are no connections to the data store
      Replication policy : Manual
      Cache Agent policy : Manual
      PL/SQL enabled.
      Data store c:\users\nikola~1.baj\appdata\roaming\timesten\demoda~1\sampledb_112

      There are no connections to the data store
      Replication policy : Manual
      Cache Agent policy : Manual
      PL/SQL enabled.
      Accessible by any group
      End of report

      Here is tnsnames.ora entry:
      tns_item_cache = (DESCRIPTION =
      (CONNECT_DATA =
      (SERVICE_NAME = TT_ItemCache)
      (SERVER = timesten_client)))

      Here is code from app:
      connStr = "User Id=/;Data Source = tns_item_cache";
      GetConnection(connStr);

      private OracleConnection GetConnection(String connStr)
      {
      OracleConnection con = new OracleConnection(connStr);

      con.Open();
      return con;
      }

      Best regards,
      Nikola
        • 1. Re: Oracle Connection problem: Unable to open library
          975714
          In addition, when I remove entry from tnsname.ora it throws ORA-12154: TNS:could not resolve the connect identifier specified exception. So that indicates that it finds tns entry, but like there is something wrong with SystemDSN, service or smth else. But, on the other hand, that DSN works fine with SQL Developer.

          Also, with ttIsql utility I'm able to connect to DSN:

          Command> Connect TT_ItemCache;
          Connection successful: DSN=TT_ItemCache;UID=nikola.bajic;DataStore=C:\TT_Temp\TT
          _ItemCache;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=
          C:\TimesTen\TT1122~1\bin\ttdv1122.dll;LogDir=C:\TT_Temp;TypeMode=0;PLSCOPE_SETTI
          NGS=IDENTIFIERS:NONE;
          (Default setting AutoCommit=1)

          Best regards,
          Nikola

          Edited by: Johnny88 on Jan 16, 2013 4:37 AM
          • 2. Re: Oracle Connection problem: Unable to open library
            Gennady Sigalaev
            Hi Nikola,

            Could you please post the code you use and the exact error which you get. Additionally, please check the env variables, like CLASSPATH, LD_LIBRARY_PATH and etc. like here(java.sql.SQLException: Problems with loading native library/missing methods

            Also "Verify that either the entry in the tnsnames.ora file is associated with a TimesTen DSN or service_name in the Easy Connect string is set to a TimesTen DSN." (http://download.oracle.com/otn_hosted_doc/timesten/odpnet/readme.htm)

            Best regards,
            Gena
            • 3. Re: Oracle Connection problem: Unable to open library
              975714
              Code:

              public ItemCache()
              {

              //connStr = "Data Source = localhost/TT_ItemCache:timesten_direct "; //+";user id=" + user + ";password=" + pwd; + ";Statement Cache Size=0"; ///ezconnect
              connStr = "Data Source = TNS_ITEM_CACHE"; ///tns name
              GetConnection(connStr);
              }


              private OracleConnection GetConnection(String connStr)
              {
              OracleConnection con = new OracleConnection(connStr);

              con.Open();
              return con;
              }

              *Exception is thrown at con.Open();

              I executed ttEnv.bat and maualy added LD_LIBRARY_PATH, but that should not be a problem because TimesTen is working fine in other tools (SQL Developer, ttIsql utility,...).
              What does it mean "associated with a TimesTen DSN"? I enetered name of my SystemDSN (used by other tools) in tnsname entry as SERVICE_NAME attrubute. I also tried with ezconnect but same thing happens.

              Best regards,
              Nikola
              • 4. Re: Oracle Connection problem: Unable to open library
                975714
                Exact exception is:
                Oracle.DataAccess.Client.OracleException was unhandled
                Message=ORA-29158: Unable to open library.
                Source=Oracle Data Provider for .NET
                ErrorCode=-2147467259
                DataSource=""
                Number=29158
                Procedure=""
                StackTrace:
                at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
                at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
                at Oracle.DataAccess.Client.OracleConnection.Open()
                at TTItemCache.ItemCache.GetConnection(String connStr) in C:\Users\nikola.bajic\Documents\Visual Studio 2010\Projects\Project1\Project1\TTItemCache.cs:line 48
                at TTItemCache.ItemCache..ctor() in C:\Users\nikola.bajic\Documents\Visual Studio 2010\Projects\Project1\Project1\TTItemCache.cs:line 39
                at TTItemCache.ItemCache.Main(String[] args) in C:\Users\nikola.bajic\Documents\Visual Studio 2010\Projects\Project1\Project1\TTItemCache.cs:line 55
                at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
                at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
                at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
                at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
                at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
                at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
                at System.Threading.ThreadHelper.ThreadStart()
                InnerException:
                • 5. Re: Oracle Connection problem: Unable to open library
                  Chrisjenkins-Oracle
                  What exact version of TimesTen are you using (full output of ttVersion command)? And version of ODP.NET? Are you sure all components are either 32 or 64 bit (i.e. you are not mixing 32 and 64 bit components)?

                  Chris
                  • 6. Re: Oracle Connection problem: Unable to open library
                    Chrisjenkins-Oracle
                    And can you please post the exact TNS entry and snapshots of the ODBC DSN setup. The 'cannot open library' error is quite generic and typically relates to some TNS name resolution or configuration issue.

                    Thanks, Chris
                    • 7. Re: Oracle Connection problem: Unable to open library
                      975714
                      I think I've come up with solution. Apparently I was using 32bit ODAC for 64bit TimesTen... I installed 64bit version, copied .ors files, imported correct DataAccess.dll and exception dissapeared. There is other one now, but I'm working on it. Anyway, thank you for your time, both Chris and Gena.

                      Best regards,
                      Nikola

                      Edited by: Johnny88 on Jan 17, 2013 3:38 AM