[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Deploy Application with Oracle Client 9.2

Posted on 2004-11-11
7
Medium Priority
?
1,023 Views
Last Modified: 2012-06-21
Hello

I have written an application with VC++ 6.0, I use OCI interface of Oracle Client to connect to Oracle server. Now i want to deploy my application to others clients. These Clients must install Oracle Client, or can we create a pakage that contain needed "dll" of Oracle Client (if we can do that, how can we replace some definitions in TNSName of Oracle Client)

thanks advance.
0
Comment
Question by:blueadmin
  • 4
  • 2
7 Comments
 
LVL 48

Accepted Solution

by:
schwertner earned 1000 total points
ID: 12563172
Because you use OCI i think you have to install Oracle client on every site which contains the needed DLLs
0
 
LVL 22

Expert Comment

by:earth man2
ID: 12565452
You can install required dlls in application directory.  You need to set environment variable TNS_ADMIN to point to where tnsnames.ora file will be kept eg application directory.

tnsnames.ora is just a text file.  Create one using sql*net configuration tool and use it as a template.  You might also need sqlnet.ora to handle all those exotic SQL*Net options.
0
 
LVL 22

Expert Comment

by:earth man2
ID: 12565583
/* here is an example using ODBC */
#include <windows.h>
#include <sql.h>
#include <sqlext.h>
#include <sqltypes.h>
#include <stdlib.h>
#include <stdio.h>

#define MAXCOLS 5
#define COL1_LEN 80

int main ( int argc, char *argv[] )
{
HENV  m_henv;
HDBC  m_hdbc;
HSTMT m_hstmt;

SQLCHAR query[] = "SELECT COL1 FROM TEST";
SQLCHAR szConnStrOut[255];
SQLCHAR col1val[COL1_LEN];
SQLCHAR m_connect[] = "DRIVER={Microsoft ODBC for Oracle};CONNECTSTRING=TESTDSNLESS.WORLD;UID=URusername;PWD=URpassword";

SQLINTEGER  col1_len;
SQLSMALLINT pcbConnStrOut;
RETCODE     ret;

char tns_string[] = "TESTDSNLESS.WORLD =\n\
  (DESCRIPTION =\n\
    (ADDRESS_LIST =\n\
      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))\n\
    )\n\
    (CONNECT_DATA =\n\
      (SERVICE_NAME = orcl.world)\n\
    )\n\
  )\n";

char buf[_MAX_PATH],tns_admin_str[_MAX_PATH + 11];
FILE *tnsnames = fopen( "tnsnames.ora", "w" );

  fputs( tns_string, tnsnames );
  fclose( tnsnames );
  sprintf( tns_admin_str, "TNS_ADMIN=\"%s\"", _getcwd( buf, _MAX_PATH - 1 ) );
  _putenv( tns_admin_str );
  SQLAllocEnv( &m_henv );
  ret = SQLAllocConnect( m_henv, &m_hdbc );
  ret = SQLDriverConnect( m_hdbc, (SQLHWND) NULL, m_connect, SQL_NTS, szConnStrOut, 255, &pcbConnStrOut, SQL_DRIVER_COMPLETE );
  if ( ret == SQL_SUCCESS ) {
    SQLAllocStmt( m_hdbc, &m_hstmt );
    ret = SQLExecDirect( m_hstmt, query, SQL_NTS );
    if ( ( ret == SQL_SUCCESS ) || ( ret == SQL_SUCCESS_WITH_INFO ) ) {
      printf( "ODBC Connect Success with %s\n", szConnStrOut );
      SQLBindCol( m_hstmt, 1, SQL_C_CHAR, col1val, COL1_LEN, &col1_len );
      while ( TRUE ) {
        ret = SQLFetch( m_hstmt );
        if (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO){
          printf("%s\n", col1val );
        } else {
          break;
        }
      }
    }
  }
 SQLDisconnect( m_hdbc );

  return 0;
}
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 22

Expert Comment

by:earth man2
ID: 12567083
This is a copy of all the oracle libraries loaded when I ran an OCI program.

'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oci.dll', No symbols loaded.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oraclient9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\ORACORE9.DLL', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\ORANLS9.DLL', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\ORAUNLS9.DLL', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oravsn9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oracommon9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\orageneric9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\ORAXML9.DLL', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\ORAXSD9.DLL', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\orannzsbb9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oran9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oranl9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oranldap9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oraldapclnt9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\orancrypt9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oratrace9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oranro9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oranhost9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oranoname9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\ORANCDS9.DLL', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\orantns9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oranms.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\oranmsp.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\ORAPLS9.DLL', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\ORASLAX9.DLL', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\ORASNLS9.DLL', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\orawtc9.dll', Cannot find or open a required DBG file.
'ocite.exe': Loaded 'F:\Oracle\ora92\bin\ORASQL9.DLL', Cannot find or open a required DBG file.
0
 

Author Comment

by:blueadmin
ID: 12679014
Ok
I have copy your code(modify paramenter in tnsnames.ora) and build test.exe.
I have build a pakage (setup .msi inlcudes test.exe and all dlls that you had showed me).

I install to another client, it's unsucess.

please help me
thanks in advance.
0
 
LVL 22

Expert Comment

by:earth man2
ID: 12681578
Well,  what fails, an error message might be helpful.
0
 

Author Comment

by:blueadmin
ID: 12701844
Sorry for my late.

ok, it appear

          "Oracle client and networking component was not found. These components are
          suppled by Oracle and are part of the Oracle Version 7.3.3 or later client software
           installation.
           Provider is unable to function until these components are installed"

thanks in advance.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to recover a database from a user managed backup
Suggested Courses
Course of the Month18 days, 15 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question