ClassNotFoundException trying to connect to Oracle database.
I'm getting this error:
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
on this line of code:
Class.forName("oracle.jdbc.driver.OracleDriver");
I've used this before in a different program on this machine (that still works) with no problem. I'm just trying to write some code that queries my Oracle SQL database. Any idea what's wrong?
Thank you.
A couple of points for those finding this thread on a search (I assume the OP has moved on).
classes12.jar is sometimes found as .zip and needs renaming to .jar.
The ojdbc4 version is more up to date.
Drivers are needed on the class path only at run time, not when you compile the code.
Similar Messages
-
Issues when trying to connect to Oracle database
Hi
We have set up a linked server in SQL Server to connect to an Oracle database. We are using SQL Server 2008 R2 Enterprise (64 bit) on Windows Server 2008 and Oracle client 11g 11.02.00.01 connecting to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production using UTF8.
Most tables are selectable without error, however, we got this error message for some:
Msg 7347, Level 16, State 1, Line 1
OLE DB provider 'OraOLEDB.Oracle' for linked server 'OurLinkedServer' returned data that does not match expected data length for column '[OraOLEDB.Oracle].Ourfieldname'. The (maximum) expected data length is 6, while the returned data length is 2.
This error message refers to a column of type char(3)
Will the characterset cause this error (I’ve read that SQL Server doesn’t support UTF8)?
If not, is there some other resolution that anyone can think of?
Any suggestions are greatly appreciated.
Thanks a lot!
TomThank You for replying, Justin!
Yes, I can connect successfully to the database through other tools - at the moment I tried SQL*Plus, Net8 Easy Config and Schema Manager.
The Oracle client in the NT machine is 8.0.5.0.0. And unfortunately I do not know anything about the Oracle installation on this machine and at the moment I don't have that person near me too whom to ask also. But I think the installation was ok, because the connection through ODBC was working before the DB upgrade as far as I understood (sorry, again at the moment I don't know what was the previous version of DB. I will ask that information as soon as possible).
The main problem that bothers me at the moment is that I can't install 8.1.* series OraODBC driver with 8.0.5.0.0 Oracle Installer. I managed to install 8.0.6.6.0 version of the driver, but not the newer ones. As far as I've understood I have to upgrade the whole Oracle in the NT machine to upgrade that installer. Am I correct?
Regards,
Madis Priilinn -
While trying to connect to Oracle database 11g from SQL developer (Error)
Hi Guys,
Installed OIM in virtual machine with Windows 2008 and when trying to connect to Database after completing installation receiving with Error ' No more data to read from socket'
Vendor code : 17410. can anybody give suggestion on this.
thanks
sri485.yes i tried connecting DB directly its working fine and i tried select * from DUAL it displays 2 . VMware with OIM working fine in my system and when i copied the same VMWARE file to other system and i tried running OIM and connecting to DB it not working.
log trace:
<Aug 21, 2012 2:28:56 PM BST> <Warning> <DeploymentService> <BEA-290014> <Inval
d user name or password.>
<Aug 21, 2012 2:28:58 PM BST> <Error> <OIM Authenticator> <BEA-000000> <Error s
tting SQL Hint java.sql.SQLException: Unable to start the Universal Connection
ool: oracle.ucp.UniversalConnectionPoolException: Error during pool creation in
Universal Connection Pool Manager MBean: oracle.ucp.UniversalConnectionPoolExce
tion: Error during pool creation in Universal Connection Pool Manager: oracle.u
p.UniversalConnectionPoolException: Universal Connection Pool already exists in
the Universal Connection Pool Manager. Universal Connection Pool cannot be adde
to the Universal Connection Pool Manager>
java.sql.SQLException: Unable to start the Universal Connection Pool: oracle.uc
.UniversalConnectionPoolException: Error during pool creation in Universal Conn
ction Pool Manager MBean: oracle.ucp.UniversalConnectionPoolException: Error du
ing pool creation in Universal Connection Pool Manager: oracle.ucp.UniversalCon
ectionPoolException: Universal Connection Pool already exists in the Universal
onnection Pool Manager. Universal Connection Pool cannot be added to the Univer
al Connection Pool Manager
at oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java
488)
at oracle.ucp.util.UCPErrorHandler.throwSQLException(UCPErrorHandler.ja
a:163)
at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java
651)
at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.
ava:890)
at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.
ava:857)
at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.
ava:851)
at oracle.iam.platform.auth.impl.DBStore.getConnection(DBStore.java:130
at oracle.iam.platform.auth.impl.DBStore.setSQLHint(DBStore.java:107)
at oracle.iam.platform.auth.impl.DBStore.<init>(DBStore.java:62)
at oracle.iam.platform.auth.impl.DBStore.getInstance(DBStore.java:83)
at oracle.iam.platform.auth.impl.Authenticator.<init>(Authenticator.jav
:87)
at oracle.iam.platform.auth.impl.Authenticator.getInstance(Authenticato
.java:71)
at oracle.iam.platform.auth.providers.wls.OIMAuthLoginModule.login(OIMA
thLoginModule.java:43)
at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(Lo
inModuleWrapper.java:110)
at java.security.AccessController.doPrivileged(Native Method)
at com.bea.common.security.internal.service.LoginModuleWrapper.login(Lo
inModuleWrapper.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:
86)
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:
80)
at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
at com.bea.common.security.internal.service.JAASLoginServiceImpl.login(
AASLoginServiceImpl.java:113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.common.security.internal.utils.Delegator$ProxyInvocationHand
er.invoke(Delegator.java:57)
at $Proxy25.login(Unknown Source)
at weblogic.security.service.internal.WLSJAASLoginServiceImpl$ServiceIm
l.login(WLSJAASLoginServiceImpl.java:89)
at com.bea.common.security.internal.service.JAASAuthenticationServiceIm
l.authenticate(JAASAuthenticationServiceImpl.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.common.security.internal.utils.Delegator$ProxyInvocationHand
er.invoke(Delegator.java:57)
at $Proxy43.authenticate(Unknown Source)
at weblogic.security.service.WLSJAASAuthenticationServiceWrapper.authen
icate(WLSJAASAuthenticationServiceWrapper.java:40)
at weblogic.security.service.PrincipalAuthenticator.authenticate(Princi
alAuthenticator.java:348)
at weblogic.security.service.PrincipalAuthenticator.authenticate(Princi
alAuthenticator.java:355)
at weblogic.management.servlet.BootstrapServlet$1.run(BootstrapServlet.
ava:169)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticat
dSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java
146)
at weblogic.management.servlet.BootstrapServlet.processGet(BootstrapSer
let.java:119)
at weblogic.management.servlet.BootstrapServlet.doGet(BootstrapServlet.
ava:108)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.ru
(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecur
tyHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.ja
a:300)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.ja
a:183)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActi
n.wrapRun(WebAppServletContext.java:3717)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActi
n.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticat
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java
120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebApp
ervletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServlet
ontext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.
ava:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: oracle.ucp.UniversalConnectionPoolException: Error during pool creat
on in Universal Connection Pool Manager MBean: oracle.ucp.UniversalConnectionPo
lException: Error during pool creation in Universal Connection Pool Manager: or
cle.ucp.UniversalConnectionPoolException: Universal Connection Pool already exi
ts in the Universal Connection Pool Manager. Universal Connection Pool cannot b
added to the Universal Connection Pool Manager
at oracle.ucp.util.UCPErrorHandler.newUniversalConnectionPoolException(
CPErrorHandler.java:368)
at oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolExceptio
(UCPErrorHandler.java:49)
at oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolExceptio
(UCPErrorHandler.java:80)
at oracle.ucp.admin.UniversalConnectionPoolManagerMBeanImpl.createConne
tionPool(UniversalConnectionPoolManagerMBeanImpl.java:316)
at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java
625)
... 61 more
<Aug 21, 2012 2:28:58 PM BST> <Error> <Configuration Management> <BEA-150035> <
n attempt was made to download the configuration for the server oim_server1 by
he user iamamin with an invalid password.>
thanks
sri485 -
Applet trying to connect to Oracle Database
Hello!
I am trying to access an Oracle 8i database from an Applet. The problem is that the following exception is reported in IE 5.5
and the Applet is not run.
exception: com.ms.security.SecurityEceptionEx[oracle/net/nt/TcpNTAdpater.connect]:cannot access "pc38"
(where my database is being hosted on the intranet at a NT workstation called pc38). The applet does not seem to be able to connect to the datase due to security reason).
In Netscape no exception is shown in the Java Console but the Applet is not run anyway.
What do I have to do for the Applet to be able to connect to the database. The code for the Applet and the HTML file have been appended to this message.
Thanx in advance
Saad
/*********************************Applet*******************************/
String serviceName="ora816";
String hostName="pc38";
String userName="ipweb355";
String password="ipweb355";
String port="1521";
Connection conn=null;
try
java.sql.DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
String url = "jdbc:oracle:thin:@"+this.hostName+":"+this.port+":"+this.serviceName;
System.out.println("url = "+url+ " UserName = "+this.userName+ " password = "+this.password+" port = "+this.port );
conn = java.sql.DriverManager.getConnection(url, this.userName, this.password);
public void paint(Graphics g){
g.drawString("HI there",20,20);
try{
Connection con = conn;
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select COUNT(*) AS NUM_ROWS from TABLE_ONE");
rs.next();
String temp = rs.getString("NUM_ROWS");
g.drawString(temp,100,20);
catch(SQLException e){
g.drawString(e.getMessage(),20,20);
/********************HTML*********************************************/
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE>
HTML Test Page
</TITLE>
</HEAD>
<BODY>
testApplet will appear below in a Java enabled browser.<BR>
<APPLET
CODEBASE = "D:\IPWeb\Swings\TreeApplet\src"
ARCHIVE = "classes111.zip"
CODE = "testApplet.class"
NAME = "TestApplet"
WIDTH = 400
HEIGHT = 300
HSPACE = 0
VSPACE = 0
ALIGN = middle
>
</APPLET>
</BODY>
</HTML>
<!--the classes111.zip is being send in the Archive file so that the java.lang.ClassNotFound Exception is not reported-->
/*********************************************************************/Hi!
Try to add this line to java.policy file on machine that's running applet:
permission java.security.AllPermission; -
TNS-12535. Trying to connect to oracle database which is on bridget VM
I have a XP host running VMWare workstation 7 hosting a guest running Windows 2003 with Oracle database 9i (copy of my original physical server which I converted, also edited listener.ora and tnsnames.ora to IP of cloned server ). Network adapter is bridge so vmnic recived IP from DHCP and I can ping from my local network. Database is up and running. On my XP host I installed oracle client 11g and TNSPING is working and I can connect my application to database.
Problem is because I can't connect from another XP PC from my network (also isntalled oracle client and changed listener.ora and tnsnames.ora to IP of cloned server) . Error is TNS-12535 TNS:operation time out. Firewall in off on both side. PIng is working ok. Is it a problem with bridge connection?
Can anybody hel me with this problem?
thanx in advance
Dragan
Edited by: 873723 on 20.07.2011. 05.06Applets have restriction in accessing resources (for security reasons -> that's why you recieved SecurityException). But normally database access is done on server-side, so put that stuff in the servlet and then send the data to the applet.
Greets
Puce -
Help needed in connecting to oracle database in unity
Hi,
I have been trying to connect to Oracle database in my codes. I have tried using OdbcConnection and OleDbconnection. But both did not allowed me to connect to the database. The database, testDb, can be accessed using SQL plus as well as the SQL developer. I even tested the connection successful using ODBC data source administrator.
the following is my code for the connection string:
OdbcConnection connectionString = "Driver={Oracle ODBC Driver};Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP )(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=Te stDb)));Uid=scott;Pwd=password;";
the error i got is [ODBC Driver Manager] Data Source name not found and no default driver specified.
for the driver parameter, i have tried using "Microsoft ODBC for Oracle". It gives me another error stating that the oracle and network components are not installed.
I even tried "Oracle in OraDb11g_home1" which was specified in the ODBC Data Source Administrator. The same error came out.
Below are some of my specifications:
Platform: Windows 7 64bit
Oracle: Oracle Database 11g Release 2 (64bit)
Unity: 4.1.2
Can someone please help me with this? What is it that i have done wrong?
Thanks.1008737 wrote:
Hi,
I have been trying to connect to Oracle database in my codes. I have tried using OdbcConnection and OleDbconnection. But both did not allowed me to connect to the database. The database, testDb, can be accessed using SQL plus as well as the SQL developer. I even tested the connection successful using ODBC data source administrator.
the following is my code for the connection string:
OdbcConnection connectionString = "Driver={Oracle ODBC Driver};Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP )(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=Te stDb)));Uid=scott;Pwd=password;";
whenever localhost (127.0.0.1) is used, this means that no remote client can ever connect to this system
The problem involves ODBC configuration & has nothing to do with Oracle. -
Hello,
I am trying to connect to oracle database 10.1.0.2.0 from jdeveloper 11.1.2.1.0 to develop an ADF application.
But it is giving me the error
Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
connection type:oracle(JDBC)
Role :SYSDBA
Driver:thin
Host:localhost
JDBC port:1521
SID:webaid
I am able to connect to the database using SQL*Plus with the same credentials.
Any help is appreciated!I take it you solved this problem, since you posted this: installing Oracle 10.1.0.2.0 (32 bit) on windows 2003 server
-
ODI topology connection error - oracle database
Hi,
I'm trying to connect to oracle database installed on a remote server through odi client installed on my windows machine. Oracle db is on RHEL 64 bit, I believe. I know the connection details such as hostname, sid etc but i'm not able to establish a connection using the oracle jdbc driver. I can perfectly connect to the db via sqldeveloper using tnsnames and also basic connection which rules out the possibility that i might be giving incorrect SID name in ODI connection since I'm using the same details for both
Error which i received is:
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.doGetConnection(LoginTimeoutDatasourceAdapter.java:133)
at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.getConnection(LoginTimeoutDatasourceAdapter.java:62)
at com.sunopsis.sql.SnpsConnection.testConnection(SnpsConnection.java:1125)
at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.getLocalConnect(SnpsDialogTestConnet.java:163)
at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.access$4(SnpsDialogTestConnet.java:159)
at com.sunopsis.graphical.dialog.SnpsDialogTestConnet$4.doInBackground(SnpsDialogTestConnet.java:519)
at com.sunopsis.graphical.dialog.SnpsDialogTestConnet$4.doInBackground(SnpsDialogTestConnet.java:1)
at oracle.odi.ui.framework.AbsUIRunnableTask.run(AbsUIRunnableTask.java:258)
at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:655)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.doGetConnection(LoginTimeoutDatasourceAdapter.java:133)
at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.getConnection(LoginTimeoutDatasourceAdapter.java:62)
at oracle.odi.core.datasource.dwgobject.support.OnConnectOnDisconnectDataSourceAdapter.getConnection(OnConnectOnDisconnectDataSourceAdapter.java:74)
at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter$ConnectionProcessor.run(LoginTimeoutDatasourceAdapter.java:217)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
... 1 more
Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:482)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:678)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:238)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:567)
at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:410)
at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:386)
at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:353)
at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:332)
... 7 more
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:411)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1222)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:330)
... 15 moretnsping works fine. To solve the problem, I changed my JDBC connection string to another format which uses connect description with service name and that solved the problem. This is what I used.
jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on) (ADDRESS=(PROTOCOL=TCP)(HOST=) (PORT=1521)) (ADDRESS=(PROTOCOL=TCP)(HOST=) (PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=))) -
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 connect to Oracle database running on Windows machine from linux.
Hi,
I'm not able to connect to oracle database running on Windows machine from Linux machine. I'm geting the below mentioned error. I have given below the code I used to connect to database and database propertes.Do I need to use any specific driver?
Please help me.
Thanks,
Sunjyoti
Code :
import oracle.jdbc.pool.OracleDataSource;
import java.sql.Connection;
import java.util.*;
import java.sql.*;
import java.io.*;
class try2{
public static void main(String args[]) {
try {
System.out.println("hi");
// Load the properties file to get the connection information
Properties prop = new Properties();
prop.load(new FileInputStream("/home/sreejith/EDIReader/Connection.properties"));
// Create a OracleDataSource instance
OracleDataSource ods = new OracleDataSource();
System.out.println("prop is "+prop);
configureDataSource(ods, prop);
Connection conn=null;
// Create a connection object
conn = ods.getConnection();
System.out.println("Connection is"+conn);
// Sets the auto-commit property for the connection to be false.
conn.setAutoCommit(false);
} catch (SQLException sqlEx){ // Handle SQL Errors
System.out.println("In exception "+sqlEx);
} catch(Exception excep) { // Handle other errors
System.out.println(" Exception "+ excep.toString());
private static void configureDataSource(OracleDataSource ods, Properties prop) {
// Database Host Name
ods.setServerName(prop.getProperty("HostName"));
// Set the database SID
ods.setDatabaseName(prop.getProperty("SID"));
// Set database port
ods.setPortNumber( new Integer( prop.getProperty("Port") ).intValue());
// Set the driver type
ods.setDriverType ("thin");
// Sets the user name
ods.setUser(prop.getProperty("UserName"));
// Sets the password
ods.setPassword(prop.getProperty("Password"));
Connection properties :
# Your Database Connection details
HostName = 10.20.3.19
SID = EDIREAD
Port = 1521
UserName = dbuser
Password = dbuser
Error I'm getting is
error while trying to connect with odbc datasource
[root@iflexpau2217 EDIReader]# java try2
hi
prop is {HostName=10.20.3.19, Password=dbuser, UserName=dbuser, SID=EDIREAD, Port=1521}
In exception java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
Also I tried to connect with weblogic JDBC driver
Code is here:
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
//import com.entrust.toolkit.util.ByteArray;
public class trial{
public static void main(String args[]) throws IOException{
System.out.println("hi");
Connection p_conn = null;
PreparedStatement xml_insert = null;
try {
// Load the JDBC driver
System.out.println("hi2");
// String driverName = "oracle.jdbc.driver.OracleDriver";
String driverName = "weblogic.jdbc.oracle.OracleDriver";
System.out.println("hi2");
Class.forName(driverName);
// Create a connection to the database
String serverName = "10.20.3.19";
String portNumber = "1521";
String sid = "EDIREAD";
//String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String url = "jdbc:bea:oracle://10.20.3.19:1521";
String username = "dbuser";
String password = "dbuser";
System.out.println("connection is:"+p_conn+"user name is"+username+"password is"+password);
p_conn = DriverManager.getConnection(url, username, password);
System.out.println("connection is:"+p_conn+"user name is"+username+"password is"+password);
xml_insert=p_conn.prepareStatement("insert into PRTB_SUBUNIT (SUBUNT_ID,SUBUNT_SUB_UNIT,SUBUNT_PHYUNT_ID) values (?,?,?)");
//InputStream in=null;
File l_file=new File("/home/sreejith/EDIReader/propertyfiles/inputfile/BUG_10802_ES_CSB19_68.txt");
BufferedReader input =null;
input=new BufferedReader(new FileReader(l_file));
String line = null;
StringBuffer trial=new StringBuffer();
while (( line = input.readLine()) != null){
trial.append(line);
trial.append(System.getProperty("line.separator"));
//InputStream is = new BufferedInputStream(new FileInputStream(l_file));
System.out.println(trial.toString());
//Blob b ;
//byte[] bytes=trial.toString().getBytes();
//System.out.println("Size-->"+bytes.length);
xml_insert.setString(1,new String("SpecailChar"));
//xml_insert.setBinaryStream(2,new ByteArrayInputStream(bytes),15920);
xml_insert.setString(3,"SpecailChar");
xml_insert.executeUpdate();
p_conn.commit();
} catch (ClassNotFoundException e) {
System.out.println("ClassNotFoundException:"+e.getMessage());
// Could not find the database driver
} catch (SQLException e) {
System.out.println("SQEXCEPTIN:"+e.getMessage());
// Could not connect to the database
}catch (FileNotFoundException e) {
System.out.println("filenot found:"+e.getMessage());
// Could not connect to the database
Error I'm getting is
error while trying with jdbc:
SQEXCEPTIN:[BEA][Oracle JDBC Driver]Error establishing socket to host and port: 10.20.3.19:1521. Reason: Connection refusedIs the Windows firewall active? Have you enabled the port on the firewall, if it is?
-
Connecting to Oracle Database - Not Connecting
I am new to JAVA and for the first time I am trying to connect to an Oracle data using JAVA. Well, I am getting an error when trying to connect to the database. What I can see the error has to do that the strings passed to make the databases connection are NULL. So, an error (see error below).
Question
How come the "connection" varriable is NULL?
It appears that the hold "try" session is not executed. Is this session out of order?
ERROR
Could not find the database connection: null
Database connection before call: null
Exception in thread "main" java.lang.NullPointerException
at TestOCIApp.main(TestOCIApp.java:39)
========= JAVA Program START =======
//import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class TestOCIApp {
public static void main(String args[]) throws ClassNotFoundException,
SQLException {
Connection connection = null;
try {
// Load the JDBC driver
String driverName = "oracle.jdbc.driver.OracleDriver";
Class.forName(driverName);
// Create a connection to the CCMS PROD database
String serverName = "192.168.2.144";
String portNumber = "1521";
String sid = "op01ccdb01";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String username = "user-id";
String password = "password";
connection = DriverManager.getConnection(url, username, password);
System.out.println("connection value: " + connection);
} catch (ClassNotFoundException e) {
// Could not find the database driver
System.out.println("Could not find the database connection: " + connection);
} catch (SQLException e) {
// Could not connect to the database
System.out.println("Could not connect to the database connection: " + connection);
System.out.println("Database connection before call: " + connection);
Statement stmt = connection.createStatement();
ResultSet rset = stmt.executeQuery("select 'Hello OCI driver tester '||USER||'!' result from dual");
while (rset.next())
System.out.println(rset.getString(1));
rset.close();
stmt.close();
connection.close();
========= JAVA Program END =========The try section is being executed just fine but only partially because you get the exception "ClassNotFoundException", which means it cannot load the Oracle driver class (so it fails at the line where it says):
Class.forName(driverName);You catch this exception, and then just print a line "Could not find the database connection: null". Then you let the code continue, obviously without having initialized your variables yet.
I would recommend rewriting those catch blocks to throw a new RuntimeException so the code will not continue further when an error is detected in the try, or to not catch them not all if you donot want to handle them there in a proper fashion.
As to your problem, you probably have not added the ojdbc14.jar to your project, and that's why it cannot find the OracleDriver class.
Finally, try to add {noformat}{noformat} around your code when you post code. It makes it a lot more readable. -
Connect to oracle database with visual studio 2005
Hi, i have a oracle database called orcl (10.2). I am trying to connect with this database with visual studio 2005. I do this:
In Server Explorer, right click in Data Connection and click in add connection.
I choose oracle database and oracle provider.
In server name I write the name of my computer, and i write the user and pass of the data base (sys or system) but it gives me this error: "ora-12514 listener doesnt know the asket for service in the description one of connection" (translated of Spanish)
what i have to write in server name? host, host:port, LISTENER,.... what?
ThanksSometimes, you can check names using from the command line:
$> tnsping <orcl>
TNS Ping Utility for 32-bit Windows: Version 8.1.7.0.0 - Production on 10-ENE-20
06 09:01:04
(c) Copyright 1997 Oracle Corporation. All rights reserved.
Attempting to contact (ADDRESS=(PROTOCOL=TCP)(HOST=server1)(PORT=1521))
Realizado correctamente (0 mseg)
$> -
Cannot connect to Oracle database from SQL Server
Hi
We have set up a SQL Server linked server and tried to use this SQL Server linked server to connect to Oracle database. We are using SQL Server 2008 and Oracle client 11g 11.02.00.01. However, we got this error message:
Msg 7347, Level 16, State 1, Line 1
OLE DB provider 'OraOLEDB.Oracle' for linked server 'OurLinkedServer' returned data that does not match expected data length for column '[OraOLEDB.Oracle].Ourfieldname'. The (maximum) expected data length is 6, while the returned data length is 2.
We are able to connect some of the tables ok but some of the tables are not connected and got the above error message.
Any suggestions are greatly appreciated.
Thanks a lot
TomHi
Here is more information. We just found out that the Oracle database team changed the character set to something else and then they changed it back to UTF8.
Currently, it is using UTF8 character set on the Oracle side. Will this causing us this error message on our sql server linked server?
The error message said "The (maximum) expected data length is 6, while the returned data length is 2."
This refers to a field/column with char(1)
Any suggestions are greatly appreciated
Thank you
Tom -
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. -
ORA-12514 when trying to connect to the database using SERVICE
Hi,
Version 10204
In a single instance database i would like to create new SERVICEs in order to use them later with Resource Manager.
The instance name is DWH.
I run the following commands:
I added to the tnsnames.ora file the following input:
XYZ =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxx)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XYZ)
As SYSDBA i execute:
> exec DBMS_SERVICE.CREATE_SERVICE('xyz','xyz');
PL/SQL procedure successfully completed.
> exec DBMS_SERVICE.START_SERVICE('xyz');
PL/SQL procedure successfully completed.
But when i tried to connect to the instance:
sqlplus ac/ac@xyzSQL*Plus: Release 10.2.0.4.0 - Production on Sat Nov 1 14:44:43 2008
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
When i am trying to connect , not via the service , its successed:
sqlplus ac/ac@dwh
SQL*Plus: Release 10.2.0.4.0 - Production on Sat Nov 1 14:45:07 2008
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Could you please help to understand why its failed to connect via SERVICE ?
ThanksYou told us.
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor.
I ask some questions, you set alias for listener port (no default) + local_listener parameter, don't you?
If you did....
Please check by .....
lsnrctl status
lsnrctl service
Let me show my example:
About 1522 (no default port)
SQL> show parameter local_listener
NAME TYPE VALUE
local_listener string ALIASLISTENER
- check tnsnames.ora file in the same location listener.ora file.
$ cat tnsnames.ora
ALIASLISTENER=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost )(PORT = 1522))
- About create new service
SQL> show parameter service_names
NAME TYPE VALUE
service_names string db
SQL> exec DBMS_SERVICE.CREATE_SERVICE('xyz','xyz');
PL/SQL procedure successfully completed.
SQL> exec DBMS_SERVICE.START_SERVICE('xyz');
PL/SQL procedure successfully completed.
SQL> show parameter service_names
NAME TYPE VALUE
service_names string xyz
$ lsnrctl status
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 02-NOV-2008 03:29:21
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1522)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date 02-NOV-2008 03:28:45
Uptime 0 days 0 hr. 0 min. 36 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File ORACLE_HOME/network/admin/listener.ora
Listener Log File ORACLE_HOME/log/diag/tnslsnr/hostname/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(PORT=1522)))
Services Summary...
Service "db" has 1 instance(s).
Instance "db", status READY, has 1 handler(s) for this service...
Service "db2XDB" has 1 instance(s).
Instance "db", status READY, has 1 handler(s) for this service...
Service "db_XPT" has 1 instance(s).
Instance "db", status READY, has 1 handler(s) for this service...
Service "xyz" has 1 instance(s).
Instance "db", status READY, has 1 handler(s) for this service...
$ lsnrctl service
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 02-NOV-2008 03:29:40
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1522)))
Services Summary...
Service "db" has 1 instance(s).
Instance "db", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "db2XDB" has 1 instance(s).
Instance "db", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:0 refused:0 current:0 max:972 state:ready
DISPATCHER <machine: hostname, pid: 30200>
(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(PORT=45572))
Service "db_XPT" has 1 instance(s).
Instance "db", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "xyz" has 1 instance(s).
Instance "db", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
The command completed successfully
Maybe you are looking for
-
I Need to mass close the schedule lines on a cuttoff date for the list of items and plant. Open schedule lines are affecting the mrp releases. Could any one suggest the solution. Regards, R.Srilakshmi
-
Twice Accounting Document genrated for single Invoice
Hi, I have the simple scenario SO-Billing - Accounting In 1 sales cycle process system genarated 2 accounting document for single invoice. Test Case Business partner 20131607 RUDRA DISTRIBUTORS Document
-
Restriction on Cisco router DPC3825
Hello I shared my internet connection by a router (Cisco DPC3825 DOCSIS 3.0 Gateway )with my roommates, but someone download or may watch the movies and it takes all bandwidth, and also it goes over usage of my internet package every month. So is the
-
Hi there we are on extended classic, SRM 5.0. User created a PO, it was approved and invoiced (follow on documents created). user realised afterwards they made a mistake and changed the PO. a changed version was created, but now it gives an error mes
-
Adobe permier pro cs6 presets missing
Adobe premier pro cs6 lion os , presets codecs are missing, it was available when we had cs5.5.2 version on lion? Any solutions?