Connect to oracle database using c program
I am using AIX environment and i want to connect to oracle database using c program.
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10825/pc_03dbc.htm#i5880
Similar Messages
-
Unable to connect to Oracle Database using Oracle Sql developer 2.1.1.64
Hi Everyone,
I am searching for some help regarding my problem with Oracle connectivity. I have installed Oracle 11g release 2 on my Windows XP Professional Laptop. For a few days after installation i could connect to the Oracle database with the SYSTEM account using Oracle SQL developer ( installed on the same Laptop) but now i am unable to do so.It gives me this annoying message:
An error was encountered performing the required operation Got a minus one from read call .Vendor code 0
However i am able to connect using Sql Plus by supplying the username SYSTEM and the corresponding password.
My TNSNAMES .ora file is as follows:
ORACLE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORACLE)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
My Listener.ora file is as follows:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\product\11.2.0\dbhome_1\bin\oraclr11.dll")
(SID_DESC =
(GLOBAL_DBNAME = Oracle)
(ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
(SID_NAME = Oracle)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(PROTOCOL_STACK =
(PRESENTATION = GIOP)
(SESSION = RAW)
ADR_BASE_LISTENER = D:\app
My Sqlnet.ora file is as follows:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
I am new to Oracle and so i need someone in this forum who can help me resolve this problem. Also i even tried connecting to the database using Toad 10.5.0.41. It give me the following error:
ORA 12537 : TNS Connection closed
Thanks for your patience and help in advance.
---PrashantHello Irian and Sue,
I can connect to the Oracle database using SQL Plus. Now when i TNSPING ORACLE from command line i get the following message :
Used parameter files:
D:\app\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =localhost
*)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORACLE)))*
TNS-12537: TNS:connection closed
Thanks for your response to my initial post.Do u have any other methods to resolve this? -
Cant connect to Oracle database using oracle db client
Hi All,
I recently created a virtual machine running windows server 2008 on my windows 7 host. Oracle database 11g is already installed on host OS(windows 7) and I have installed oracle 11g client on the guest OS(windows server 2008) and trying to connect to oracle database from remote server using oracle client but getting this error:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATAI am trying to connect using oracle client as below:
C:\Users\Administrator>SET ORACLE_SID = HR84DEV
C:\Users\Administrator>SQLPLUS /NOLOG
SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 10 06:16:34 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> CONNECT SYSADM/[email protected]
ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
I have created database with name - HR84DEV
HOST ip address is - 192.168.56.1
I googled this error and as most of resources/blogs talked about having correct entry on listner.ora and tnsnames.ora file, I did the changes on both of these files accordingly.
PFB the cotent of both of these files:
tnsnames.ora
# tnsnames.ora Network Configuration File: C:\MyApps\Oracle\product\11.2.0\dbhome_\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
HR84DEV =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = HR84DEV)
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
listner.ora
# listener.ora Network Configuration File: C:\MyApps\Oracle\product\11.2.0\dbhome_\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\MyApps\Oracle\product\11.2.0\dbhome_)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\MyApps\Oracle\product\11.2.0\dbhome_\bin\oraclr11.dll")
(SID_DESC =
(SID_NAME = HR84DEV)
(ORACLE_HOME = C:\MyApps\Oracle\product\11.2.0\dbhome_)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\MyApps\Oracle\product\11.2.0\dbhome_\bin\oraclr11.dll")
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
ADR_BASE_LISTENER = C:\MyApps\Oracle
Please not that I dont have any problem in connect to database locally.Thanks Nicolas,
Actually, there was a problem with my oracle client installation. I uninstalled it and then installed back again but still, even after following your instructions I get some error.
Here what I did:
Created tnsnames.ora file as below:
HR84DEV =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = HR84DEV)
Placed it under appropriate directory and then checked the connection with database using the command shown below:
C:\Users\Administrator>tnsping HR84DEV
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 10-FEB-2
012 08:42:03
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\MyApps\Administrator\product\11.2.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 192.168.56.1)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = HR84DEV)))
OK (20 msec)
Then tried to connect to database as below:
C:\Users\Administrator>SET ORACLE_SID=HR84DEV
C:\Users\Administrator>SQLPLUS /NOLOG
SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 10 08:25:56 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> CONNECT SYSADM/SYSADM@HR84DEV
ERROR:
ORA-28547: connection to server failed, probable Oracle Net admin error
But still getting error.
I Googled this error and tried to figure out what the problem is and came across the possible cause which is because I haven't specify that the service should run as a user who is in domain admin group.
well, I am not really sure about this and dont know what user name and password I should enter in OracleserviceHR84DEV-properties-log on-this account.
do I really need to set this? -
Unable to establish connection to oracle database using sql developer
hi guys,
i tried to connect to the oracle database using the sql developer, but it fails. it replies the following message:
Status: Failure -Test failed: Io exception: The Network Adapter could not establish the connection
what should i do? any helpPlease provide a little more information:
1) SQLDeveloper version.
2) Database Version.
3) Database location (same machine or on the network).
4) Connection method (basic,TNS).
5) Connection type (Thin,Thick/OCI).
Usually the first thing to check is if you have correctly entered the right information for your database connection, then if everything seems to be OK the database itself should be checked for potential problems. -
Connection to oracle database using jdbc
i am using eclipse as editor.
How to connect to the database?
How to create a new table in oracle database through a servlet invoked
program.
My servlet receives input from an html page and then it can either do the above mentioned activities by itself or can invoke any other java class if necessary.This doesn't seem to have anything to do with JavaMail.
You need to post this question to a more appropriate forum. -
Connect to Oracle Database Using Netbeans
I am trying to connect to Oracle but it keeps saying that it is locked.
***Error:
Cannot establish a connection to jdbc:oracle:thin:@localhost:1521:XE using oracle.jdbc.OracleDriver (ORA-28000: the account is locked )
Just a FYI, this is the link that I am using to go through this program...
https://netbeans.org/kb/docs/ide/oracle-db.html
Any suggestions anyone??Ok, I uninstalled and reinstalled Oracle and it still wasn't working. However, it was an user issue. When I went back to the link that I previously posted and reread, it gave me the user name and the password that I was supposed to use, in order for this to work.
username: systems
password: whatever I used to set up Oracle.
So, I didn't KISS - Keep It Simple Stupid.
Thanks for trying to help.
hope -
Connecting to Oracle database using c# project
I m new to oracle database, Right now I am using oracle 10g XE,some how I have created all the tables procedures etc I am able to connect to the same using sqlplus/server explored/XE
but while connecting via c# code I am getting invalid username/password error
my connection string is
<add key="ServerDB" value="Provider=MSDAORA;Data Source=localhost;uid=xyz;pwd=xyz"/>
please help me in this
I m not sure whether the provider name I m using is correct or not. please helpFor the Microsoft OleDb Provider for Oracle the connection string should look like the following:
Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword
Note that it's User ID and not UID. You can find more examples below, depending upon which driver/provider that you are using:
http://www.connectionstrings.com/oracle/
Paul ~~~~ Microsoft MVP (Visual Basic) -
Connectivity with oracle database using web Dynpro(for java)
Hi,
In web Dynpro we will connect to SAP systems by using Adaptive RFC. Then How to connect the oracle 8i/9i using webdynpro? Plese tell me the procedure to establish the connecting using enterprise portal?
Thanks & Regards,
Mastanvali ShaikHi,
Check these:
WebDynpro and Oracle using DTOs
https://wiki.sdn.sap.com/wiki/display/VC/JDBCConnectionSetup
Connecting Problum of SQL
Greetings,
Praveen Gudapati
[Points are welcome for helpful answers] -
Connect to ORACLE database using SDKODBC Wrapper
hi everyone,
i have tried connecting to ms access database through SDKODBC Wrapper.
by the same way, i have also created a odbc connection from control panel-> admin tools -> ODBC connections.
for a oracle database.
i have also verified the URI and it says true.
URI is some thing like this,
"odbc://oradb?table=table_1&emp_no='123'#emp_name"
when i am trying to connect with the oracle DB it returns ODBC error
ISDKODBCWrapper::ODBCState mstate = sdk.Query(uri, WideString(newValue));
if (ISDKODBCWrapper::ODBCNormal == mstate)
do i need to configure in DB side so that it works fine?
thanks,
raja.here is the odbc trace log
odbcad32 e98-ed8 ENTER SQLAllocEnv
HENV * 0007BA8C
odbcad32 e98-ed8 EXIT SQLAllocEnv with return code 0 (SQL_SUCCESS)
HENV * 0x0007BA8C ( 0x00a61540)
odbcad32 e98-ed8 ENTER SQLAllocConnect
HENV 00A61540
HDBC * 0007BA94
odbcad32 e98-ed8 EXIT SQLAllocConnect with return code 0 (SQL_SUCCESS)
HENV 00A61540
HDBC * 0x0007BA94 ( 0x00a615e8)
odbcad32 e98-ed8 ENTER SQLDriverConnectW
HDBC 00A615E8
HWND 00150EA2
WCHAR * 0x74324EC8 [ -3] "******\ 0"
SWORD -3
WCHAR * 0x74324EC8
SWORD 2
SWORD * 0x00000000
UWORD 1 <SQL_DRIVER_COMPLETE>
odbcad32 e98-ed8 EXIT SQLDriverConnectW with return code 0 (SQL_SUCCESS)
HDBC 00A615E8
HWND 00150EA2
WCHAR * 0x74324EC8 [ -3] "******\ 0"
SWORD -3
WCHAR * 0x74324EC8
SWORD 2
SWORD * 0x00000000
UWORD 1 <SQL_DRIVER_COMPLETE>
odbcad32 e98-ed8 ENTER SQLDisconnect
HDBC 00A615E8
odbcad32 e98-ed8 EXIT SQLDisconnect with return code 0 (SQL_SUCCESS)
HDBC 00A615E8
odbcad32 e98-ed8 ENTER SQLFreeConnect
HDBC 00A615E8
odbcad32 e98-ed8 EXIT SQLFreeConnect with return code 0 (SQL_SUCCESS)
HDBC 00A615E8
odbcad32 e98-ed8 ENTER SQLFreeEnv
HENV 00A61540
odbcad32 e98-ed8 EXIT SQLFreeEnv with return code 0 (SQL_SUCCESS)
HENV 00A61540
InDesign 8d0-198 ENTER SQLAllocHandle
SQLSMALLINT 1 <SQL_HANDLE_ENV>
SQLHANDLE 00000000
SQLHANDLE * 0012F6F0
InDesign 8d0-198 EXIT SQLAllocHandle with return code 0 (SQL_SUCCESS)
SQLSMALLINT 1 <SQL_HANDLE_ENV>
SQLHANDLE 00000000
SQLHANDLE * 0x0012F6F0 ( 0x0fae1540)
InDesign 8d0-198 ENTER SQLSetEnvAttr
SQLHENV 0FAE1540
SQLINTEGER 200 <SQL_ATTR_ODBC_VERSION>
SQLPOINTER 0x00000003
SQLINTEGER 0
InDesign 8d0-198 EXIT SQLSetEnvAttr with return code 0 (SQL_SUCCESS)
SQLHENV 0FAE1540
SQLINTEGER 200 <SQL_ATTR_ODBC_VERSION>
SQLPOINTER 0x00000003 (BADMEM)
SQLINTEGER 0
InDesign 8d0-198 ENTER SQLAllocHandle
SQLSMALLINT 2 <SQL_HANDLE_DBC>
SQLHANDLE 0FAE1540
SQLHANDLE * 0012F6F4
InDesign 8d0-198 EXIT SQLAllocHandle with return code 0 (SQL_SUCCESS)
SQLSMALLINT 2 <SQL_HANDLE_DBC>
SQLHANDLE 0FAE1540
SQLHANDLE * 0x0012F6F4 ( 0x0fae15e8)
InDesign 8d0-198 ENTER SQLDriverConnectW
HDBC 0FAE15E8
HWND 00000000
WCHAR * 0x74324EC8 [ -3] "******\ 0"
SWORD -3
WCHAR * 0x74324EC8
SWORD 2
SWORD * 0x00000000
UWORD 0 <SQL_DRIVER_NOPROMPT>
InDesign 8d0-198 EXIT SQLDriverConnectW with return code -1 (SQL_ERROR)
HDBC 0FAE15E8
HWND 00000000
WCHAR * 0x74324EC8 [ -3] "******\ 0"
SWORD -3
WCHAR * 0x74324EC8
SWORD 2
SWORD * 0x00000000
UWORD 0 <SQL_DRIVER_NOPROMPT>
DIAG [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0)
InDesign 8d0-198 ENTER SQLDriverConnectW
HDBC 0FAE15E8
HWND 00000000
WCHAR * 0x74324EC8 [ -3] "******\ 0"
SWORD -3
WCHAR * 0x74324EC8
SWORD 2
SWORD * 0x00000000
UWORD 0 <SQL_DRIVER_NOPROMPT>
InDesign 8d0-198 EXIT SQLDriverConnectW with return code -1 (SQL_ERROR)
HDBC 0FAE15E8
HWND 00000000
WCHAR * 0x74324EC8 [ -3] "******\ 0"
SWORD -3
WCHAR * 0x74324EC8
SWORD 2
SWORD * 0x00000000
UWORD 0 <SQL_DRIVER_NOPROMPT>
DIAG [HY000] General error: Invalid file dsn '' (556)
InDesign 8d0-198 ENTER SQLDisconnect
HDBC 0FAE15E8
InDesign 8d0-198 EXIT SQLDisconnect with return code -1 (SQL_ERROR)
HDBC 0FAE15E8
DIAG [08003] [Microsoft][ODBC Driver Manager] Connection not open (0)
InDesign 8d0-198 ENTER SQLFreeHandle
SQLSMALLINT 2 <SQL_HANDLE_DBC>
SQLHANDLE 0FAE15E8
InDesign 8d0-198 EXIT SQLFreeHandle with return code 0 (SQL_SUCCESS)
SQLSMALLINT 2 <SQL_HANDLE_DBC>
SQLHANDLE 0FAE15E8
InDesign 8d0-198 ENTER SQLFreeHandle
SQLSMALLINT 1 <SQL_HANDLE_ENV>
SQLHANDLE 0FAE1540
InDesign 8d0-198 EXIT SQLFreeHandle with return code 0 (SQL_SUCCESS)
SQLSMALLINT 1 <SQL_HANDLE_ENV>
SQLHANDLE 0FAE1540 -
Unable to connect to oracle database using RODM
Hello,
I am trying to follow the steps described in
http://www.oracle.com/technetwork/articles/datawarehouse/saternos-r-161569.html
but I keep getting the same error message after the
DB <- RODM_open_dbms_connection(dsn="orcl", uid="dm", pwd="dm")command. The message is
Error in typesR2DBMS[[driver]] <<- value[c("double", "integer", "character", :
cannot change value of locked binding for 'typesR2DBMS'
and doing a traceback() I get
2: setSqlTypeInfo(driver, list(double = "double precision", integer = "integer",
character = "varchar(255)", logical = "varchar(255)"))
1: RODM_open_dbms_connection(dsn = "orcl", uid = "dm", pw = "dm")
Could anyone suggest some way to fix this? I am stuck and I need to get this working asap.
Thank you very much in advanceHello Mark,
Thank you for your reply.
I tried installing Oracle R Enterprise but I got stuck again, this time apparently because I do not have Oracle database 11.2.0.3 but rather 11.2.0.1.0.
So I would like to ask you if there is some way of using RODM, or some other way of having R access to ODM algorithms?
Thank you,
Filipe -
Hi All,
How to connect the Oracle database using C/C++ on Mac OS X? I have used Instant Client library "instantclient-basic-macosx-10.1.0.3" provided by the Oracle but could not be success. I'm using PowerPC G4, Mac OS X 10.4.9, and XCode version 2.4.1.
Specially Mr Oscar Armanini has done this in C on Mac OS X. Please let me know. I would be very thankful to you.
Thanks,
GhufranHi Ghufran
there are two Metalink Notes on using Instant Client with PowerPc Mac:
https://metalink.oracle.com/metalink/plsql/showDoc?db=NOT&id=316497.1
How to Install, Configure and Test Oracle 10g Instant Client Basic,
SQL*Plus and SDK Packages for Mac OS X
(Runs OCI sample code - cdemo81.c)
https://metalink.oracle.com/metalink/plsql/showDoc?db=NOT&id=332588.1
How to Install, Configure and Test Oracle 10g Instant Client Basic,
SQL*Plus and SDK Packages for Mac OS X
(Runs OCCI sample code - occidml.cpp)
The first Metalink Note uses an OCI examples and it is pasted here below,
in case you don't have a Metalink ID.
The second Metalink Note uses an OCCI example.
I have never used Instant Client (neither on Os X or on other platform),
but I was successful on compiling C programs (no GUI involved) using the
Full Client installed on my PowerBook G4.
I'm a DBA, but I was a developer years ago (about when Oracle 7.3
was considered a giant step forward): I installed the Oracle 10.1 db
(a complicated job for a developer) and I got the Full Client
installed as well, for free, so I was happy to compile one of the demo C sources
(those that you can find in the Oracle Pro*C manuals:
by the way, Oracle Pro*C manuals are really worth reading).
Good luck
Oscar
Applies to: Oracle Server - Enterprise Edition - Version: 10.1.0.3
Apple Macintosh PowerPC
Goal
This article will show you how to install and configure your 10g Instant Client (IC) Software for the Mac.
It will install the following packages:
the Basic package
the SQL*Plus package and
the SDK package
and then test its connectivity to an Oracle database using SQL*Plus.
It will also show you how to setup and test a sample program, cdemo81.c, that uses the Oracle Call Interface (OCI)
to connect to the database.
The sample program is located under the <Instant_Client>/sdk/demo directory.
Solution1. Download the following three (3) files from the Oracle Technology Network (OTN) website.
You will need an account to do this.
Macintosh OS X 10g Instant Client Software
a. instantclient-basic-macosx-10.1.0.3.zip (32,395,622 bytes)
b. instantclient-sqlplus-macosx-10.1.0.3.zip (326,740 bytes)
c. instantclient-sdk-macosx-10.1.0.3.zip (293,913 bytes)
NOTE: The above three (3) files will be updated as new patches are released for the 10g Instant Client software. 10.1.0.3 or later versions (10.1.0.x) of these files may be used similarly with this article.
2. Save the following text into a file called tnsnames.ora:
# If you receive an
# ORA-12154: TNS:could not resolve the connect identifier specified
# error when running the setup script and attempting to connect to Oracle
# from SQL*Plus then the name of your SERVICE NAME (i.e. ORCL) may require
# that you include the DOMAIN (i.e. US.ORACLE.COM) in order to connect successfully.
# To obtain the DOMAIN of your environment, type "hostname" from your shell
# and it should report this information back to you. Configure your SERVICE
# NAME to look like Example 2.
# Example 1
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = database_machine.us.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
# Example 2
#ORCL.US.ORACLE.COM =
# (DESCRIPTION =
# (ADDRESS = (PROTOCOL = TCP)(HOST = database_machine.us.oracle.com)(PORT = 1521))
# (CONNECT_DATA =
# (SERVER = DEDICATED)
# (SID = orcl)
3. Save the following text into a file called sqlplus_script.sql:
SELECT user FROM dual;
SELECT sysdate FROM dual;
SELECT 'successful ' AS TEST_RESULTS FROM dual;
exit;
4. Save the following text into a file called setup1:
# ===========================================
# MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP1
# ===========================================
# DESCRIPTION
# ===========
# This script will install and configure your 10g Instant Client (IC) Software
# for the Mac. It will install the Basic, SQL*Plus and SDK (OCI/OCCI) packages
# and then test its connectivity to an Oracle database using SQL*Plus.
# Once this script has completed, you will need to run the script SETUP2 to build
# and run the CDEMO81.C sample application located under the <IC>/sdk/demo folder
# in your newly installed Instant Client home.
# NOTE: In order for this script to run successfully, you MUST perform any
# necessary actions required under the SETUP section below.
# SETUP
# =====
# (1) You MUST be in a directoy with ALL of the following files
# BEFORE running this script:
# 1 - instantclient-basic-macosx-10.1.0.3.zip
# 2 - instantclient-sqlplus-macosx-10.1.0.3.zip
# 3 - instantclient-sdk-macosx-10.1.0.3.zip
# 4 - tnsnames.ora (configured properly)
# 5 - sqlplus_script.sql (connectivity test)
# 6 - setup1 (this file)
# 7 - setup2 (will run this file later)
# (2) Edit the TNSNAMES.ORA file and update it with the necessary information
# to connect to a database on your network. Be sure to note the comments
# in this file. You will have to change the following information:
# SERVICE NAME (orcl or orcl.us.oracle.com)
# HOST (database_machine.us.oracle.com)
# PORT (1521)
# SID (orcl)
# (3) Go to the end of this scrip and modify the following line:
# ./instantclient10_1/sqlplus scott/tiger@orcl @sqlplus_script.sql
# Replace "orcl" with the SERVICE NAME you used in step (2) above.
# (4) To run this script use the command: ". setup1"
# BEGINNING OF SCRIPT
# output this file to your shell
echo
echo MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP1
echo
#more setup1
# output the TNSNAMES.ORA file to your shell
echo TNSNAMES.ORA FILE
echo
more tnsnames.ora
# remove the instantclient10_1 directory should it exist
echo
echo CHECKING FOR instantclient10_1 DIRECTORY...
echo WILL REMOVE DIRECTORY IF IT ALREADY EXISTS
echo
rm -d -f -R instantclient10_1
# extract the instantclient software (basic, sql*plus & sdk)
echo
echo
echo INSTALLING SOFTWARE...
echo
echo BASIC
echo
unzip instantclient-basic-macosx-10.1.0.3.zip
echo
echo SQL*PLUS
echo
unzip instantclient-sqlplus-macosx-10.1.0.3.zip
echo
echo SDK
echo
unzip instantclient-sdk-macosx-10.1.0.3.zip
# set the following environment variables
# Uncomment if you want a way to find the Instant Client (IC) home quickly
#export IC=$PWD/instantclient10_1
# Dynamic Library path required to use the Instant Client (IC) software
export DYLD_LIBRARY_PATH=$PWD/instantclient10_1
# TNS_ADMIN is required if using the TNSNAMES.ORA file (recommended)
export TNS_ADMIN=$PWD/instantclient10_1
# display the modified environment variables
echo
echo SETTING ENVIRONMENT VARIABLES
echo
echo DYLD_LIBRARY_PATH
echo $DYLD_LIBRARY_PATH
echo
echo TNS_ADMIN
echo $TNS_ADMIN
# display all environment variables
#echo
#echo ALL ENVIRONMENT VARIABLES
#echo
#env
# copy the TNSNAMES.ORA to the instantclient directory
echo
echo COPYING TNSNAMES.ORA TO INSTANT CLIENT [IC] DIRECTORY
echo
cp tnsnames.ora ./instantclient10_1/tnsnames.ora
# list the contents of the IC directory to see what has been installed
echo
echo INSTANT CLIENT [IC] DIRECTORY
echo
ls ./instantclient10_1
echo
# SQL*Plus Connectivity Test
# To connect to the database specified in your TNSNAMES.ORA file change the
# SERVICE NAME (i.e. orcl) below to the name of the entry in your TNSNAMES.ORA
# file designating the specific database in which you want to connect to
echo
echo SQL*PLUS CONNECTIVITY TEST
./instantclient10_1/sqlplus scott/tiger@orcl @sqlplus_script.sql
# Alternately, you can connect from SQL*Plus to Oracle without using a TNSNAMES.ORA
# file. You can embed the NAME-VALUE pair of the SERVICE NAME from the TNSNAMES.ORA
# file directly into the connection string making sure to use the proper HOST, PORT
# and SID like so:
#./instantclient10_1/sqlplus scott/tiger@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=database_machine.us.oracle.com)(PORT=1521)))(CONNECT_DATA=(SID=orcl)))
5. Save the following text into a file called setup2:
# ===========================================
# MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP2
# ===========================================
# DESCRIPTION
# ===========
# This script will build and run the OCI sample application CDEMO81.C inside
# your Instant Client (IC) software located under the <IC>/sdk/demo folder.
# NOTE: In order for this script to run successfully
# (A) you MUST have already run the script SETUP1 successfully
# and
# (B) you MUST perform any necessary actions required under the SETUP
# section below.
# SETUP
# =====
# (1) You need to edit the CDEMO81.C application PRIOR to running this script to
# change the connection information. By default, the application will attempt
# to connect as user SCOTT with password TIGER to a local Oracle database using
# the BEQ-LOCAL network protocol. This will not work.
# (A) You need to make sure you have the SCOTT/TIGER schema created in your database.
# If not, have your DBA create it by running the script "SCOTT.SQL" from your
# <ORACLE_HOME>/rdbms/admin folder.
# (B) You need to modify the CDEMO81.C application to connect to the database
# you have configured inside your TNSNAMES.ORA file.
# (i) Open the CDEMO81.C file located under the <IC>/sdk/demo folder.
# (ii) Find the following line of code:
# (void) OCIServerAttach( srvhp, errhp, (text *)"", strlen(""), 0);
# and change the two empty strings to the SERVICE NAME you are using like so
# (void) OCIServerAttach( srvhp, errhp, (text *)"ORCL", strlen("ORCL"), 0);
# (iii) Save the file.
# (2) You MUST be in the initial directory where you copied all of the files listed
# in script SETUP1. In this same location you will find SETUP2. Run SETUP2 from
# this location.
# (3) To run this script use the command: ". setup2"
# BEGINNING OF SCRIPT
# output this file to your shell
echo
echo MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP2
echo
#more setup2
# output the TNSNAMES.ORA file to your shell
echo TNSNAMES.ORA FILE
echo
more tnsnames.ora
# output the username, password and service name from CDEMO81.C file to your shell
echo
echo USERNAME, PASSWORD AND SERVICE NAME INFO FROM YOUR OCI cdemo81.c FILE
echo
#more ./instantclient10_1/sdk/demo/cdemo81.c
grep -i "*username" ./instantclient10_1/sdk/demo/cdemo81.c
grep -i "*password" ./instantclient10_1/sdk/demo/cdemo81.c
grep -i OCIServerAttach ./instantclient10_1/sdk/demo/cdemo81.c
# display the required environment variables
#env
echo
echo REPORTING REQUIRED ENVIRONMENT VARIABLES
echo
echo DYLD_LIBRARY_PATH
echo $DYLD_LIBRARY_PATH
echo
echo TNS_ADMIN
echo $TNS_ADMIN
# move to the sdk/demo directory
cd ./instantclient10_1/sdk/demo
echo
echo CHANGING TO [IC]/SDK/DEMO DIRECTORY
echo
ls
# run demo application
echo
echo ATTEMPTING TO RUN APPLICATION
echo
echo BUILDING APPLICATION USING PROVIDED MAKE FILE, [IC]/sdk/demo/demo.mk...
echo
make -f demo.mk
echo
echo
echo INSTANT CLIENT [IC] DIRECTORY...
echo
ls ../..
echo
echo CREATING links FOR REQUIRED LIBRARIES IN INSTANT CLIENT [IC] FOLDER...
echo
echo - libclntsh.dylib
echo - libocci.dylib
ln ../../libclntsh.dylib.10.1 ../../libclntsh.dylib
ln ../../libocci.dylib.10.1 ../../libocci.dylib
echo
echo INSTANT CLIENT [IC] DIRECTORY WITH links CREATED...
echo
ls ../..
echo
echo
echo EXECUTING APPLICATION...
echo
cdemo81
echo
echo
# TROUBLE-SHOOTING
# If you receive the following error messages:
# Error - ORA-24327: need explicit attach before authenticating a user
# Error - ORA-03114: not connected to ORACLE
# Then you did not modify the CDEMO81.C application with proper SERVICE NAME
# information. See step 1B under the SETUP section in this script to resolve
# this error.
6. Take all seven (7) files and move them into the same directory on your OS where you want to install the Instant Client software from:
1 - instantclient-basic-macosx-10.1.0.3.zip
2 - instantclient-sqlplus-macosx-10.1.0.3.zip
3 - instantclient-sdk-macosx-10.1.0.3.zip
4 - tnsnames.ora
5 - sqlplus_script.sql
6 - setup1
7 - setup2
7. Open the file tnsnames.ora. Be sure to review the comments in this file. You will have to change the following information to connect to a database on your network:
SERVICE NAME (orcl or orcl.us.oracle.com)
HOST (database_machine.us.oracle.com)
PORT (1521)
SID (orcl)
Save the file.
8. Open the file setup1, go to the end of this script and modify the following line:
./instantclient10_1/sqlplus scott/tiger@orcl @sqlplus_script.sql
Replace orcl with the SERVICE NAME you used in Step 7 above. Save the file.
9. You are now ready to install the 10g Instant Client software for Mac OS X. From the location where your seven (7) files reside, issue the following command:
[macosx]/oracle> . setup1
NOTE: Be sure to include the period "." and a space " " before the word "setup1" so all environment variables persist for the current session.
This will install the Instant Client Basic and SQL*Plus software and connect to the database specified in the tnsnames.ora file.
10. Here is the sample output of a successful execution of the setup1 script:
[macosx]/oracle> . setup1
MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP1
TNSNAMES.ORA FILE
# If you receive an
# ORA-12154: TNS:could not resolve the connect identifier specified
# error when running the setup script and attempting to connect to Oracle
# from SQL*Plus then the name of your SERVICE NAME (i.e. ORCL) may require
# that you include the DOMAIN (i.e. US.ORACLE.COM) in order to connect successfully.
# To obtain the DOMAIN of your environment, type "hostname" from your shell
# and it should report this information back to you. Configure your SERVICE
# NAME to look like Example 2.
# Example 1
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = gbednars-pc.us.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
# Example 2
#ORCL.US.ORACLE.COM =
# (DESCRIPTION =
# (ADDRESS = (PROTOCOL = TCP)(HOST = gbednars-pc.us.oracle.com)(PORT = 1521))
# (CONNECT_DATA =
# (SERVER = DEDICATED)
# (SID = orcl)
CHECKING FOR instantclient10_1 DIRECTORY...
WILL REMOVE DIRECTORY IF IT ALREADY EXISTS
INSTALLING SOFTWARE...
BASIC
Archive: instantclient-basic-macosx-10.1.0.3.zip
inflating: instantclient10_1/classes12.jar
inflating: instantclient10_1/libclntsh.dylib.10.1
inflating: instantclient10_1/libnnz10.dylib
inflating: instantclient10_1/libocci.dylib.10.1
inflating: instantclient10_1/libociei.dylib
inflating: instantclient10_1/libocijdbc10.dylib
inflating: instantclient10_1/ojdbc14.jar
SQL*PLUS
Archive: instantclient-sqlplus-macosx-10.1.0.3.zip
inflating: instantclient10_1/README_IC.htm
inflating: instantclient10_1/glogin.sql
inflating: instantclient10_1/libsqlplus.dylib
inflating: instantclient10_1/sqlplus
SDK
Archive: instantclient-sdk-macosx-10.1.0.3.zip
creating: instantclient10_1/sdk/
creating: instantclient10_1/sdk/demo/
inflating: instantclient10_1/sdk/demo/cdemo81.c
inflating: instantclient10_1/sdk/demo/demo.mk
inflating: instantclient10_1/sdk/demo/occidemo.sql
inflating: instantclient10_1/sdk/demo/occidemod.sql
inflating: instantclient10_1/sdk/demo/occidml.cpp
creating: instantclient10_1/sdk/include/
inflating: instantclient10_1/sdk/include/nzerror.h
inflating: instantclient10_1/sdk/include/nzt.h
inflating: instantclient10_1/sdk/include/occi.h
inflating: instantclient10_1/sdk/include/occiAQ.h
inflating: instantclient10_1/sdk/include/occiCommon.h
inflating: instantclient10_1/sdk/include/occiControl.h
inflating: instantclient10_1/sdk/include/occiData.h
inflating: instantclient10_1/sdk/include/occiObjects.h
inflating: instantclient10_1/sdk/include/oci.h
inflating: instantclient10_1/sdk/include/oci1.h
inflating: instantclient10_1/sdk/include/oci8dp.h
inflating: instantclient10_1/sdk/include/ociap.h
inflating: instantclient10_1/sdk/include/ociapr.h
inflating: instantclient10_1/sdk/include/ocidef.h
inflating: instantclient10_1/sdk/include/ocidem.h
inflating: instantclient10_1/sdk/include/ocidfn.h
inflating: instantclient10_1/sdk/include/ociextp.h
inflating: instantclient10_1/sdk/include/ocikpr.h
inflating: instantclient10_1/sdk/include/ocixmldb.h
inflating: instantclient10_1/sdk/include/odci.h
inflating: instantclient10_1/sdk/include/oratypes.h
inflating: instantclient10_1/sdk/include/ori.h
inflating: instantclient10_1/sdk/include/orid.h
inflating: instantclient10_1/sdk/include/orl.h
inflating: instantclient10_1/sdk/include/oro.h
inflating: instantclient10_1/sdk/include/ort.h
inflating: instantclient10_1/sdk/include/xa.h
SETTING ENVIRONMENT VARIABLES
DYLD_LIBRARY_PATH
/oracle/instantclient10_1
TNS_ADMIN
/oracle/instantclient10_1
COPYING TNSNAMES.ORA TO INSTANT CLIENT [IC] DIRECTORY
INSTANT CLIENT [IC] DIRECTORY
README_IC.htm libocci.dylib.10.1 sdk/
classes12.jar libociei.dylib* sqlplus*
glogin.sql libocijdbc10.dylib* tnsnames.ora
libclntsh.dylib.10.1* libsqlplus.dylib*
libnnz10.dylib ojdbc14.jar
SQL*PLUS CONNECTIVITY TEST
SQL*Plus: Release 10.1.0.3.0 - Production on Fri Aug 19 15:26:08 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options
USER
SCOTT
SYSDATE
19-AUG-05
TEST_RESULTS
successful
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options
IF THE SQL*PLUS CONNECTIVITY TEST WAS SUCCESSFUL
READ SETUP2 TO CONFIGURE AND RUN THE OCI cdemo81.c SAMPLE
[macosx]/oracle>
11. Once you have obtained a successful execution of the setup1 script, you are ready to configure cdemo81.c to connect to the database you have configured inside your tnsnames.ora file.
Open the cdemo81.c file located under the <Instant_Client>/sdk/demo folder. Find the following line of code:
(void) OCIServerAttach( srvhp, errhp, (text *)"", strlen(""), 0);
Change the two (2) empty strings to the SERVICE NAME you used in Step 7 above.
(void) OCIServerAttach( srvhp, errhp, (text *)"ORCL", strlen("ORCL"), 0);
Save the file.
12. You are now ready to run cdemo81.c. You MUST issue the following command from the initial directory where you copied all of the files in Step 6:
[macosx]/oracle> . setup2
NOTE: Be sure to include the period "." and a space " " before the word "setup2" so all environment variables persist for the current session.
This script will configure your environment, build and run the OCI sample code connecting to the database specified in the tnsnames.ora file.
13. Here is the sample output of a successful execution of the setup2 script:
[macosx]/oracle> . setup2
MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP2
TNSNAMES.ORA FILE
# If you receive an
# ORA-12154: TNS:could not resolve the connect identifier specified
# error when running the setup script and attempting to connect to Oracle
# from SQL*Plus then the name of your SERVICE NAME (i.e. ORCL) may require
# that you include the DOMAIN (i.e. US.ORACLE.COM) in order to connect successfully.
# To obtain the DOMAIN of your environment, type "hostname" from your shell
# and it should report this information back to you. Configure your SERVICE
# NAME to look like Example 2.
# Example 1
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = gbednars-pc.us.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
# Example 2
#ORCL.US.ORACLE.COM =
# (DESCRIPTION =
# (ADDRESS = (PROTOCOL = TCP)(HOST = gbednars-pc.us.oracle.com)(PORT = 1521))
# (CONNECT_DATA =
# (SERVER = DEDICATED)
# (SID = orcl)
USERNAME, PASSWORD AND SERVICE NAME INFO FROM YOUR OCI cdemo81.c FILE
static text username = (text ) "SCOTT";
static text password = (text ) "TIGER";
(void) OCIServerAttach( srvhp, errhp, (text *)"ORCL", strlen("ORCL"), 0);
REPORTING REQUIRED ENVIRONMENT VARIABLES
DYLD_LIBRARY_PATH
/oracle/instantclient10_1
TNS_ADMIN
/oracle/instantclient10_1
CHANGING TO [IC]/SDK/DEMO DIRECTORY
cdemo81.c* demo.mk occidemo.sql occidemod.sql occidml.cpp
ATTEMPTING TO RUN APPLICATION
BUILDING APPLICATION USING PROVIDED MAKE FILE, [IC]/sdk/demo/demo.mk...
rm -rf SunWS_cache
rm -rf ../../libclntsh.dylib
rm -rf ../../libocci.dylib
rm -rf cdemo81 cdemo81.o occidml occidml.o
/usr/bin/gcc -c -I../include -I/rdbms/public/ -I/oracore/include -I/oracore/publ
ic -I/oracore/port/include -I/nlsrtl/include -I/plsql/public -I/plsql/include -I
/network/public -I/network/include -I/otrace/public -I/otrace/include/ -I/precom
p/public -I/precomp/include/ -I/slax/include -I/ordts/public -I/ordts/include -I
/javavm/include -I/javavm/include/osds/unix/solaris -I/ctx/public -I/ordvir/publ
ic -I/ordvir/include -idirafter . -g -DRE_ENTRANT -DOCCI_NO_WSTRING=1 -DMAC_O
SX -D_GNU_SOURCE -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -D_BCER
T_API_ -DRSA_PLATFORM=RSA_PLATFORM_MAC_PPC_DARWIN -DNTEV_USE_POLL -DNTEV_USE_GE
NERIC -DNET_USE_LDAP -DOCCI cdemo81.c
ln ../../libclntsh.dylib.10.1 ../../libclntsh.dylib
ln ../../libocci.dylib.10.1 ../../libocci.dylib
/usr/bin/g++ -o cdemo81 cdemo81.o -L../../ -locci -lclntsh -lpthread
rm -rf ../../libclntsh.dylib
rm -rf ../../libocci.dylib
/usr/bin/g++ -c -I../include -I/rdbms/public/ -I/oracore/include -I/oracore/publ
ic -I/oracore/port/include -I/nlsrtl/include -I/plsql/public -I/plsql/include -I
/network/public -I/network/include -I/otrace/public -I/otrace/include/ -I/precom
p/public -I/precomp/include/ -I/slax/include -I/ordts/public -I/ordts/include -I
/javavm/include -I/javavm/include/osds/unix/solaris -I/ctx/public -I/ordvir/publ
ic -I/ordvir/include -idirafter . -g -DRE_ENTRANT -DOCCI_NO_WSTRING=1 -DMAC_O
SX -D_GNU_SOURCE -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -D_BCER
T_API_ -DRSA_PLATFORM=RSA_PLATFORM_MAC_PPC_DARWIN -DNTEV_USE_POLL -DNTEV_USE_GE
NERIC -DNET_USE_LDAP -DOCCI occidml.cpp
In file included from ../include/occi.h:43,
from occidml.cpp:11:
../include/occiData.h:411: warning: use of `long double' type; its size may
change in a future release
../include/occiData.h:411: warning: (Long double usage is reported only once
for each file.
../include/occiData.h:411: warning: To disable this warning, use
-Wno-long-double.)
ln ../../libclntsh.dylib.10.1 ../../libclntsh.dylib
ln ../../libocci.dylib.10.1 ../../libocci.dylib
/usr/bin/g++ -o occidml occidml.o -L../../ -locci -lclntsh -lpthread
rm -rf ../../libclntsh.dylib
rm -rf ../../libocci.dylib
INSTANT CLIENT [IC] DIRECTORY...
README_IC.htm libocci.dylib.10.1 sdk/
classes12.jar libociei.dylib* sqlplus*
glogin.sql libocijdbc10.dylib* tnsnames.ora
libclntsh.dylib.10.1* libsqlplus.dylib*
libnnz10.dylib ojdbc14.jar
CREATING links FOR REQUIRED LIBRARIES IN INSTANT CLIENT [IC] FOLDER...
- libclntsh.dylib
- libocci.dylib
INSTANT CLIENT [IC] DIRECTORY WITH links CREATED...
README_IC.htm libnnz10.dylib libsqlplus.dylib*
classes12.jar libocci.dylib ojdbc14.jar
glogin.sql libocci.dylib.10.1 sdk/
libclntsh.dylib* libociei.dylib* sqlplus*
libclntsh.dylib.10.1* libocijdbc10.dylib* tnsnames.ora
EXECUTING APPLICATION...
Enter employee name (or CR to EXIT): LARRY
Enter employee job: CEO
Enter employee salary: 10000
Enter employee dept: 40
LARRY added to the OPERATIONS department as employee number 7974
Enter employee name (or CR to EXIT):
Exiting...
[macosx]/oracle/instantclient10_1/sdk/demo>
14. If you have any problems running this script please open a Service Request (SR) with Oracle Support for further assistance and be sure to upload the output from the script to the SR.
ReferencesNote
332588.1 - How to Install, Configure and Test Oracle 10g Instant Client Basic, SQL*Plus and SDK Packages for Mac OS X (Runs OCCI sample code - occidml.cpp)
Errors
ORA-3114 "not connected to ORACLE"
ORA-24327 need explicit attach before authenticating a user
ORA-12154 "TNS:could not resolve service name" -
How does one connect to an Oracle Database using OO4O as sysdba using VB 6?
Hi,
Can any one give suggestion to connect an Oracle Database using OO4O as sysdba using VB 6.0. Generally it supports only database, userid/password only.
For Eg:
Option Explicit
Dim m_oraSession As Object
Dim m_oraDatabase As Object
Private Sub Command1_Click()
Set m_oraSession = CreateObject("OracleInProcServer.XOraSession")
Set m_oraDatabase = m_oraSession.DBOpenDatabase("Database", "user/password", 0&)
MsgBox "Connected to " & m_oraDatabase.Connect & "@" & m_oraDatabase.DatabaseName
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set m_oraDatabase = Nothing
Set m_oraSession = Nothing
End Sub
Thanks & Regards,
Kishore.P
E-Mail: [email protected]You can't connect AS SYSDBA with OO4O.
-
Connect to Oracle database from Perl on Solaris x86
Hi,
How can I connect to Oracle database using Perl scripts on Solaris x86. It seems that DBD-Oracle Perl module requires Oracle client installed to work. Is there any Oracle client available for Solaris x86? Any one got a workaround? Thanks.
Angus LeeYes, you absolutely must have some portions of the rdbms installed before you can proceed. If your Solaris x86 machine is only a client, then you can get away with installing just ?/rdbms/mesg and ?/rdbms/lib.
I have Oracle 7.3.4, 8.0.5, 8.0.6, and 8.1.6 for Intel Solaris 2.6. I don't know if they'll run on Solaris 8 or 9 but I'm trying to upgrade at this very moment. As long as you conform to Oracle developer license, then you may download them from my machine.
I believe the reason Oracle dropped their Intel Solaris port is probably because Sun went through a period where they themselves dropped their Intel port. They've picked back up and if enough Oracle on Intel Solaris customers scream, then Oracle might pick it back up again too.
Send me an email if you're interested in the downloads. -
Could not connect to Oracle database from excel macro. Getting connection not open.
Hi all,
I could not connect to oracle database using excel macro. After much R&D also, I cannot find right solution. Please help me where I am doing wrong.
Sub Button2_Click()
Dim Conn As New ADODB.Connection
Dim RS As New ADODB.Recordset
Dim Cmd As New ADODB.Command
Dim sqlText As String
Dim Row As Long
Dim Findex As Long
Dim Data As Worksheet
Dim X As Long
Dim UID As String
Dim PWD As String
Dim Server As String
Dim strCon As String
Application.Calculation = xlCalculationManual
UID = "myUserid" 'Enter the User ID
PWD = "myPassword" 'Enter the password
Server = "myHostname or myServername"
Set Data = Sheets("Sheet2")
Data.Select
Range("A:J").ClearContents
strCon1 = "Provider = Microsoft.ACE.OLEDB.12.0;DATA SOURCE=myHostName;Database=myDBname;uid=myUserid;pwd=myPassword;"
Conn.Open (strCon1)
Cmd.ActiveConnection = Conn
Cmd.CommandType = adCmdText
' Put your query next
sqlText = " select * from table "
Cmd.CommandText = sqlText
Set RS = Cmd.Execute
For X = 0 To 17
Data.Cells(1, X + 1) = RS.Fields(X).Name
Next
Do While Not RS.EOF 'this loops through the data and puts it in the spreadsheet
Row = Row + 1
For Findex = 0 To RS.Fields.Count - 1
Data.Cells(Row + 1, Findex + 1) = RS.Fields(Findex).Value
Next Findex
RS.MoveNext
Loop
Application.Calculation = xlCalculationAutomatic
Application.Calculate
End Sub
sammyI have set oci.dll in to the path specified. Prior to this I musy say that, I have 64 bit excel 2010 & installed respective drivers from the link provided http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html
But
still I am facing as:-" Provider cannot be found. It may not be properly installed."
sammy -
Connecting to an Oracle database using ASP
Hi
I am having problems connecting to an Oracle database using ASP. I am trying to do this for a school project the school's database server is running Oracle 9i. The repository is version 6. The web server I have access to only has ASP not ASP.net. What kind of connection string would I need to be able to connect to the database?You do need to ensure that the Oracle client and Oracle server are compatible, but that is generally pretty easy to accomplish. Unless you are trying to cross more than one major release (i.e. 9.2 client to a 7.3.4 database), you're pretty safe there.
You could try downloading and installing the latest 8.1.7.x Oracle ODBC driver from OTN on the machine with the 8.1.7 Oracle client (I believe the last ODBC patchset was 8.1.7.10), but I don't have particular confidence that that will solve the problem. If it doesn't, we can do an ODBC trace to focus in on the issue, but installing a new driver is a much easier process, so that probably ought to be the first step.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Maybe you are looking for
-
How to get rid of 'created with adobe elements 9 trial version' message off my video?
I have created a film using the trial version and this message is right in the centre of the whole thing! Does anyone know how I can get it off? Help :S Hann x
-
Max number of records in MDM workflow
Hi All Need urgent recommendations. We have a scenario where we need to launch a workflow upon import of records. The challenge is source file contains 80k records and its always a FULL load( on daily basis) in MDM. Do we have any limitation in MDM w
-
Flex License Issue.....?
HI All We are testing the application using qtp. When we are testing the application we are getting flex license error after recording 30 test cases.. I developed my application using sdk version 3.2.0 and i implemented li
-
How do I get the theme music back?
all of suddenly, the theme music went off. In all of the themes, can not play the music. What can I do?
-
2 levels of Classifications in activities in WEB UI
Hi, We are using activities in WEB UI in SAP CRM 2007. We want to have 2 levels of classifications/reasons with classification 2 dependent on classification1. Can we use category modeler for that or category modeler is only for IC Web? If yes please