I would like to connect to Oracle 11g Enterprise DB from eclipse as part of JPA Project. I have service name, U/P and Hostname. But the option provided for me in eclipse is SID, which I do not have.
I use SQL Developer to connect to database and it works perfectly.
I am not sure how to connect from eclipse with Service Name. any help?
I tried to give Service Name for SID. It didn't work.
Jar I am using is ojdbc14.jar. Not sure if this is the right Jar.
You can use "Generic JDBC" connection profile and specify url directly:
jdbc:oracle:thin:#//host:port/service_name
While creating a New Database connection you can also fix this by using 'Other Driver' instead of the Oracle JDBC Thin Driver. But, while adding the 'Drivers' in the 'Connection Profile' you have to add the same ojdbc jar that you usually use and add whatever properties in the 'Properties' tab of the 'New Driver Definition' keeps asking you for.
The first error you may get is: Required property in driver definition missing value: Driver Class.
SID or system identifier is created when you install oracle11g in your system. It is always there.
I would suggest you to Edit Connection on Sql Developer and look for SID, it has to be there.
Alternatively you would have a tnsnames.ora file located at ORACLE_HOME > Network > Admin, it looks somewhat as follows:
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = XXXX))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = XXXX))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
Lookout for SERVICE_NAME=orcl on the last 3rd line, here in orcl is your SID, which you should be using to connect to oracle from eclipse.
Please use the fully qualified connection URL as shown below.
jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS=(HOST=myhost)(PORT=1521)(PROTOCOL=tcp))(CONNECT_DATA=(SERVICE_NAME=myorcldbservicename)))
you have to change the driver to ojdbc6
1. -click on the ojdbc14.jar and choose remover
2. click add jar and browse to the location u downloaded it orcaleDB then follow the that path "\oraclexe\app\oracle\product\11.2.0\server\jdbc\lib"
3. choose the ojdbc6 driver and exit out
Related
I have SQL Server 2012 and Oracle 11g installed on the same virtual machine and OS is Windows Server 2012. I am trying to connect Oracle to SQL Server. I have kept the machines same in the hopes that process will be easier. I created the machine 2 days ago to test the connection process before applying it on server.
Following are the steps I have taken.
1) Created ODBC Connection for SQL Server with the name sqlodbc with the simple/non-admin user credentials which is tested successfully.
2) My tnsnames.ora file is below
sqlodbc
(DESCRIPTION =
(ADDRESS = (PROTOCOL = tcp)(HOST = localhost)(PORT = 1433))
(CONNECT_DATA =(SID = sqlodbc))
(HS = OK)
)
[SQL Server port is 1433] [I even tried with the port 1521 but same problem]
3) The SID_LIST_LISTENER part from listener.ora file is as follow
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME=sqlodbc)
(ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = hsodbc)
)
)
4) I have created initsqlodbc.ora file at [Oracle_Home]\hs\admin with following
HS_FDS_CONNECT_INFO = sqlodbc
HS_FDS_TRACE_LEVEL = off
5) I created the public database link
create public database link sqls
connect to "user" identified by "pass"
using 'sqlodbc';
I went through other threads on here but I could not find any solution for my problem.
I am trying to run the following command
select * from empnew#sqls
Where have I gone wrong with the configuration? Or if there is any step that I have missed? Or I have taken the wrong approach altogether?
I would really appreciate any help I can get.
Thank you.
[NOTE: When I restarted the machine, and I tried running the same command, I was getting the "Database not open error" initially but then it changed into the TNS error later on after a minute or so.]
So there must have been some syntax error which was giving me the issue.
I recreated the ODBC connection, re-written entries in tnsnames.ora and listener.ora file and removed all the previous commented entries. The spaces and " and brackets can cause problems so just make sure everything is accounted for.
My updated ora files can be found at this location for future references. (its another question for different error but contains all the information in correct format.)
Issue connecting Oracle 11g to SQL Server 2012 -- ORA-12523: TNS:listener could not find instance appropriate for the client connection
Try this TNSNAMES.ora entry instead:
sqlodbc
(DESCRIPTION =
(ADDRESS = (PROTOCOL = tcp)(HOST = localhost)(PORT = 1433))
(CONNECT_DATA =(SERVICE_NAME = sqlodbc))
(HS = OK)
)
I'm completely newbie to the database.
I successfully installed instant client for Mac, and now can use sqlplus /nolog in the terminal, but I can't log in any database because I don't have any except for some txt files, nor can I create any user.
After a lot of search, I have tried these codes to create a new user, however, none of them can do.
SQL> create user t1 identified by tiger;
SP2-0640: Not connected
SQL> conn t1/tiger
ERROR:
ORA-12545: Connect failed because target host or object does not exist
SQL> create user t1#localhost identified by tiger;
SP2-0640: Not connected
SQL> conn t1/tiger#localhost
ERROR:
ORA-12541: TNS:no listener
SQL> conn scott/tiger#orcl
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Here are my settings
tsnnames.ora file
ORALOCAL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
listener.ora file
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
)
)
The software requirement in my lab class is Oracle XE on Windows, but I don't feel like to run VM on my Mac, and I saw what they did was just login the user that created when they installed XE, then create, connect, start the txt file to build a database, and all done. I feel really weird that it is so difficult for Mac users.
To connect oracle database using oracle client, you have to add proper database name and description in clinet tnsname.ora file.
Once you install oracle client on any server. please check it is possible to prompt sqlplus command or not? If not then please set environment variable on client machine.
"Anything wrong in my tsnnames.ora?"
Yes. It points to a database which doesn't exist.
Instant Client is software for connecting to a database. It is not a database nor can it create one. It's the difference between a browser and the internet. You need to install Oracle database server to create a database.
"The software requirement in my lab class is Oracle XE on Windows"
XE is not and never has been available on Mac. There's never been an official explanation of this; my personal theory says it's to do with chip architecture as XE was available for x86 - Windows, Linux - and Mac used PowerPC. (This matters because Oracle enforces one instance of XE per machine).
So now that Apple uses Intel chips too why not port XE to MacOS? Because everybody uses VMs these days.
"I don't feel like to run VM on my Mac"
Why not? Oracle provide full fledged images for Oracle VirtualBox, although not Oracle XE 11g. Find them here.
" I feel really weird that it is so difficult for Mac users."
Education has always favoured Windows OS because it was most likely to be the OS students knew from home, because it was - and is - the prevailing desktop OS. And Windows machines cost much less than Macs, which is also a consideration for the many students.
HI,
In Visual Studio 2010 I select Add new connection and then I chose Oracle server. Then I choose Oracle provider for .Net. And this window comes.
I wonder what I should write in the Data Source text field if I the Oracle database is at server with name AZSSRV and IP address 172.117.17.1 ? Any help will be appreciated
After getting inspired with #Harrison's answer I finally was able to create a successful connection with Oracle Database located in a remote server. So I did exactly the way Harrison told me -created an environment variable named TNS_ADMIN and gave it the path where the TNSNAMES.ORA file is located(in my case it is :C:\app\Mikola\product\11.2.0\client_1\Network\Admin\Sample).But this on it own was not enough. I had to add some parameters to the file by opening it in a simple Text editor like Notepad.Here I'm posting the inner look of the TNSNAMES.ORA file:
OracleServerHost =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.117.17.1)(PORT = 1521))
(CONNECT_DATA =(SID = ORCL)
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
After saving and restaring VS 2010 I got "OracleServerHost" in the Data Source name drop down list.
P.S. Modifying the TNSNAMES.ORA file might not be necessary if you had already configured the file during the installation of Oracle Client.
Your entries from TNSNames.ora should appear here and you would select the one that you need to use.
Since the drop down does not seem to be working, it would indicate that VS2010 cannot find your Oracle home.
An easy solution to this is to create an environmental variable called
TNS_ADMIN
and place the path to the TNSNames.ora file you wish to you
as such
C:\app\MyDir\product\11.2.0\client_1\Network\Admin\
Close VS2010. Make the environment variable changes, then reopen, the drop down should then show you the available ora connections you may want to use.
(you can look # this thread for a bit more info: http://forums.oracle.com/forums/thread.jspa?threadID=2213359&tstart=0)
hth
I have a database "TEST", to which I connect at address 123.45.67.89:1521.
How do I connect to it using PL/SQL Developer?
In the "database" section of the logon dialog box, enter //hostname.domain:port/database, in your case //123.45.67.89:1521/TEST - this assumes that you don't want to set up a tnsnames.ora file/entry for some reason.
Also make sure the firewall settings on your server are not blocking port 1521.
I would recommend creating a TNSNAMES.ORA file. From your Oracle Client install directory, navigate to NETWORK\ADMIN. You may already have a file called TNSNAMES.ORA, if so edit it, else create it using your favorite text editor.
Next, simply add an entry like this:
MYDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 123.45.67.89)(PORT = 1521))
(CONNECT_DATA = (SID = TEST)(SERVER = DEDICATED))
)
You can change MYDB to whatever you like, this is the identifier that applications will will use to find the database using the info from TNSNAMES.
Finally, login with MYDB as your database in PL/SQL Developer. It should automatically find the connection string in the TNSNAMES.ORA.
If that does not work, hit Help->About then click the icon with an "i" in it in the upper-lefthand corner. The fourth tab is the "TNS Names" tab, check it to confirm that it is loading the proper TNSNAMES.ORA file. If it is not, you may have multiple Oracle installations on your computer, and you will need to find the one that is in use.
The problem is not the TNS file, in PLSQL Developer, if you don't have the oracle installation, you need to provide the location of the OCI.DLL file.
In PLSQL DEV app go to Tools-Preferences-Oracle/connections-OCI Library.
In my case I put the next address C:\Oracle\InstantClient-win32-11.2.0.1.0\oci.dll.
If have Weblogic app installed, I didnt tried but if you want try to put the next location
C:\Oracle\Middleware\wlserver_10.3\server\adr.
In addition to Richard Cresswells and dpbradleys answer:
If you neither want to create a TNS name nor the '//123.45.67.89:1521/Test' input works (some configurations wont), you can put
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 123.45.67.89)(PORT = 1521)) (CONNECT_DATA = (SID = TEST)(SERVER = DEDICATED)))
(as one line) into the 'database' section of the login dialog.
I am facing to this problem so many times till I have 32bit PL/SQL Developer and 64bit Oracle DB or Oracle Client.
The solution is:
install a 32bit client.
set PLSQL DEV-Tools-Preferencies-Oracle Home to new 32bit client Home
set PLSQL DEV-Tools-Preferencies-OCI to new 32 bit home /bin/oci.dll For example: c:\app\admin\product\11.2.0\client_1\BIN\oci.dll
Save and restart PLSQL DEV.
Edit or create a TNSNAMES.ORA file in c:\app\admin\product\11.2.0\client_1\NETWORK\admin folder like mentioned above.
Try with TNSPING in console like
C:>tnsping ORCL
If still have problem, set the TNS_ADMIN Enviroment properties value pointing to the folder where the TNSNAMES.ORA located, like: c:\app\admin\product\11.2.0\client_1\network\admin
Username : username
Password : password
Database : //123.45.67.89:1521/TEST
Connect as : Normal
this work for me and (version 13.0.6.1911 64 bit)
I am trying to use MS access to connect to a Oracle database.
I keep on getting the following error message:
ORA-12154: TSN- could not resolve the connect identifier secified
The Oracle Drivers OracleClient10g can verify that the database server exists.
I have a section in my tsnnames.ora file that looks like this:
UBASEP10G =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = bxxx-xxx.yyyy.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = UBASE)
)
)
per my attempts to get this error resolves I added this to the sqlnet.ora file:
NAMES.DIRECTORY_PATH= (HOSTNAME, ONAMES, TNSNAMES,LDAP,EZCONNECT)
When using the Windows ODBC driver configuration utility it asks for the following
following information
DATA SOURCE NAME : MYSOURCE NAME
TSN SERVICE NAME:UBASEP10G
USERID:MYUSERID
any suggestions ?????
I don't have Access, but using Excel 2007, I had to do the following:
Open ODBC Administrator (in the Administrator Control Panel)
For either User DSN or System DSN, click Add...
Select "Oracle in OraDb10g_home1" as the driver
In the Oracle ODBC Driver Configuration, I entered:
Data Source Name: myOracleDsn
Description: This is my DSN for my Oracle Database
TNS Service Name: oratns
User ID: scott
Click Test Connection, and enter "tiger" for the password. Obviously, I'm connecting to my scott/tiger sample Oracle database. Also, when I installed Oracle, I picked oratns as my TNS name. The other two values above are arbitrary -- you'll see them in dialogs in Excel.
If the test works, click OK.
Go to Excel and make a new connection to a DSN. The dialog will show "myOracleDsn" as an option. Select it, enter "tiger" for the password again, and you should get a working connection.
Try changing (CONNECT_DATA = (SERVICE_NAME = UBASE) ) to (CONNECT_DATA = (SID = UBASE) ) in your TNSNAMES.ora file.
ServiceName and SID aren't necessarily the same and consequently aren't always interchangeable.
The SERVICENAME parameter refers to a particular GLOBAL_DBNAME specified in the listener.ora file on the database server. It's an alias for an instance on the server. You can have multiple servicenames on a server referring to the same SID. The SID parameter refers to a particular instance on that server.
The advantage of using servicename on the client side is that the DBA can change the actual instance being referenced by a servicename transparently to the clients using that name. I can have this on the server listener.ora file:
(SID_DESC =
(GLOBAL_DBNAME = THESERVICE)
(ORACLE_HOME = d:\oracle\10.2.0_DB)
(SID_NAME = SID1)
Later, I can change the actual database being referenced by switching the listener.ora configuration:
(SID_DESC =
(GLOBAL_DBNAME = THESERVICE)
(ORACLE_HOME = d:\oracle\10.2.0_DB)
(SID_NAME = SID2)
and nobody's the wiser on the client side. No changes were necessary in the tnsnames.ora files on the clients.
Can you log in to the database in question via SQL*Plus? Doing this from another machine with a working connection (or the DB server itself) is fine also.
If so, run this:
select value from v$parameter where name='service_names';
In your TNSNAMES.ORA, use one of the values listed there for the SERVICE_NAME.
In you ODBC connection, all you'll need is to set the TNS Service Name to the name you used above, "UBASEP10G"
Let's back up to square one. Open a command window and connect to your database:
sqlplus myuserid/mypassword#UBASEP10G
Does this connect successfully?
Since the answer is no, is there a way you CAN connect successfully to this database? BQ is correct, your problem is with the servicename of UBASE. You need to determine what the listener on the server thinks the name of that database is. Do you have access to the server? Can you execute the command "lsnrctl status" on the server? This will tell you the services that are registered with the listener, and look something like this:
Services Summary...
Service "UBASE" has 1 instance(s).
Instance "UBASE", status READY, has 1 handler(s) for this service...
Try tnsping and report your results.
Bad:
C:\>tnsping notreal.world
TNS Ping Utility for 32-bit Windows: Version 9.2.0.5.0 - Production on 29-OCT-2008 15:56:47
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
C:\oracle\ora92\network\admin\sqlnet.ora
TNS-03505: Failed to resolve name
Good:
O:\>tnsping real.world
TNS Ping Utility for 32-bit Windows: Version 9.2.0.5.0 - Production on 29-OCT-2008 15:57:42
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
C:\oracle\ora92\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = DBSERVER.DOMAIN.COM)(PORT = 1521)) (LOAD_BALANCE = YES) (FAILOVER = YES))
(CONNECT_DATA = (SERVICE_NAME = REAL.WORLD)
(FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 10) (DELAY = 3))))
OK (40 msec)