connecting oracle 8i with datasource method giving exception - oracle

I only have Oracle 8i installed in my system working fine. I can successfully connect using jdbc to it using driverManager but the problem occurs when I am using OracleDataSource to connect to it. It says Oracle not Available. I guess I am doing something wrong in providing the sid.
Part of my code -
OracleDataSource ds = new OracleDataSource();
ds.setDriverType("thin");
ds.setServerName("localhost");
ds.setPortNumber(1521);
ds.setDatabaseName("ORCL0"); // sid
ds.setUser("scott");
ds.setPassword("tiger");
Connection conn = ds.getConnection();
tnsnames.ora entry (part of it) -
ORACLE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = guddus-comp)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oracle)
)
)
listener.ora entry (part of it) -
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\ora92)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = oracle)
(ORACLE_HOME = C:\oracle\ora92)
(SID_NAME = ORCL0)
)
(SID_DESC =
(GLOBAL_DBNAME = dbabhi)
(ORACLE_HOME = C:\oracle\ora92)
(SID_NAME = DBABHI)
)
)
In my code I'v tried oracle, orcl also in place of ORCL0 but anything other than ORCL0 gives Io exception: Connection refused whereas providing ORCL0 gives Exception - ORA-01034: ORACLE not available.... So I guess ORCL0 is correct but I anticipate some other problem.

Related

How do I connect from an EntityFramework client to an Oracle DB using Oracle Connection Manager as proxy?

I try to create a db client with EF that will connect to an Oracle Db through an Oracle Connection Manager proxy. I can reach the db from the client using sqlplus using source_route in the tnsnames.ora file of the client:
orcl_db_with_cman =
(DESCRIPTION =
(SOURCE_ROUTE = YES)
(ADDRESS =
(PROTOCOL = TCP)(HOST = cm_proxy_server)(PORT = 1522)
)
(ADDRESS =
(PROTOCOL = TCP)(HOST = db_server)(PORT = 1521)
)
(CONNECT_DATA = (SERVICE_NAME = orcl_db)
)
)
However, Oracle DB Managed Access Provider does not seem to support the source_route parameter in the connection string Data Source = (Description= (Source_Route=YES..;.
Can Source_Route be defined in an Oracle Provider connection string?
If Source_Route is not an available parameter for Oracle Providers, the Connection Manager proxy could be setup to route the connection.
However, I receive time-out when configuring CM to route:
Listener.ora on Connection Manager server:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl_db)
(ORACLE_HOME = D:\OraClient\product\19.0.0\client_1)
(SID_NAME = orcl_db)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
)
tnsnames.ora on Connection Manager server:
orcl_db =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db_server)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl_db)
)
)

Oracle - How to configure Oracle 21c XE for SSL traffic encryption?

I am new to Oracle and I am trying to configure an Oracle 21c XE database (built from the official Dockerfile) to encrypt traffic using SSL/TLS (just for encryption, not for mutual authentication). My configuration files are:
/opt/oracle/oradata/dbconfig/XE/listener.ora
# listener.ora Network Configuration File:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle/product/21c/dbhomeXE)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(ADDRESS = (PROTOCOL = TCPS)(HOST = 0.0.0.0)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
# Extra configuration to enable SSL
SSL_CLIENT_AUTHENTICATION = FALSE
WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /opt/my_wallet/)
)
)
/opt/oracle/oradata/dbconfig/XE/sqlnet.ora
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, HOSTNAME)
# Extra configuration to enable SSL
SSL_CLIENT_AUTHENTICATION = FALSE
WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /opt/my_wallet/)
)
)
SSL_CIPHER_SUITES = (SSL_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA)
/opt/oracle/oradata/dbconfig/XE/tnsnames.ora
# tnsnames.ora Network Configuration File:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCPS)(HOST = 0.0.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
LISTENER_XE =
(ADDRESS = (PROTOCOL = TCPS)(HOST = 0.0.0.0)(PORT = 1521))
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
I also added a self-signed certificate to the wallet referenced in the configuration files.
When trying to connect with sqlplus system/<password>#XE it returns ORA-12514: TNS:listener does not currently know of service requested in connect descriptor.
I have tried making different changes to the previous configuration, but I am always getting the same error. Am I missing something?
Thanks in advance.

I want to connect through DBlink to my Oracle DB using my public IP address

I want a friend to access to my oracle DB through DBlink. Im new to Databases, so i could not make this work.
I suppose i have to create a listener with my public IP or so. So i used the NET configuration wizard to create a service name. I used the public IP but the wizard throws a timeout when trying to connect. I tried to create a Listener with my public IP in the listener.ora in por 1522 but it did not work eaither
What i have done:
I checked the listener.ora, it has a LISTENER with my local ip (192.168.1.134) and the port is 1521
I checked the tnsnames.ora, it has the same IP and port of the listener.
I made the port forwarding in my router.
I used the wizard to create a Listener with public IP.
I used the wizard to create a service name with public IP address but it cannot connect
TNSNAMES.ORA:
# tnsnames.ora Network Configuration File: D:\Programas\Oracle\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.134)(PORT = 1521))
JORGE_ORA_DB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 190.153.1.32)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.134)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
LISTENER.ORA:
# listener.ora Network Configuration File: D:\Programas\Oracle\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\Programas\Oracle)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\Programas\Oracle\bin\oraclr19.dll")
)
)
REMOTE =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = croquer.ddns.net)(PORT = 1522))
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.134)(PORT = 1521))
)
)
Thank you for your responses!
The solution was quite simple. I created a new inbound and outbound rule in the firewall i both computers. Then it worked for me.
The rules are port type rules for port 1521 (in my case).

Cannot connect to newly created schema in Oracle18c. Giving Listener does not know of SID error

I am creating a new Schema in Oracle 18c. Schema is created successfully. But when i try to connect to this schema, i get an error saying:
Status : Failure -Test failed: Listener refused the connection with
the following error: ORA-12514, TNS:listener does not currently know
of service requested in connect descriptor
This is my listener.ora file:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\Oracle18c)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\Oracle18c\bin\oraclr18.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set (On Oracle DB)

I already read other posts about this problem, but mine is not a Hibernate problem, is a connection problem.
I installed Oracle database 12 c on a new machine, but I can't connect my web application to it. I get this error:
Caused by: org.hibernate.HibernateException: Access to
DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
And I'm sure that this problem is just about the connection. The application perfectly works if I try to connect to a MySQL database.
This is my tnsnamesora file
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
These are my connection data:
spring.datasource.url=jdbc:oracle:thin:#localhost:1521/orcl
spring.datasource.username=DB_EXAMPLE
spring.datasource.password=Frema16242 //this is correct
spring.datasource.database-driver=oracle.jdbc.driver.OracleDriver
hibernate.c3p0.preferred_test_query=SELECT 1 FROM DUAL
These are the Oracle services running on my pc.
Of course I'm able to connect to my schema using Toad .
Can you spot what is my error?
I think i had same problem like you. I tried to set connection using datasource. I used sessionFactory with constructor datasource argument. I solved it when i created properties object and i put hibernate.dialect property to it. Next i set this properties on my sessionFactory object.

Resources