How can I run Oracle XE on localhost only? - oracle

Is there a way that I can configure a XE installation on Windows to only use ports on the localhost interface and not the external interfaces? I'd like to run it for development without having anyone else be able to connect to my instance.
I tried modifying the listener.ora and tnsnames.ora file, changing the 'HOST =' entries to localhost. My hosts file has the following line in it:
127.0.0.1 localhost
When I've done this, and restarted the services, apex stops working (it doesn't listen on port 8080) and I'm unable to connect to the database using JDBC. I get the following error with JDBC:
Exception in thread "main" 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
The Connection descriptor used by the client was:
localhost:1521:XE
I should note that both apex and JDBC work fine if I change the 'HOST = entries back to my machines hostname and restart the services.

There are two parts for this (because there are two 'technologies' serving different ports).
Firstly the listener for database port 1521. You use a SQLNET.ORA setting (tcp.invited_nodes) as a soft firewall, so the listener will ignore other nodes.
Secondly, for the 8080 PL/SQL gateway you need to use DBMS_XDB.SETLISTENERLOCALACCESS as described here

Related

Oracle Database Connection Running on Virtual Machine

I'm trying to connect to Oracle database hosted in a Linux Virtual Machine, using SQL Developer. Any leads on how to go about it?
I tried connecting using the IP address as HostName. But doesn't work.
In SQL Developer, create a new connection using the following
Connection Name:
Username: The username you use to log into the database
Password:
Hostname: The IP address of the virtual machine
Port: 1521
SID: The Oracle SID of the database you want to connect to
Status : Failure -Test failed: IO Error: The Network Adapter could not
establish the connection (CONNECTION_ID)
This error is almost always caused by a firewall. Make sure the local firewall on the database VM has opened the port 1521 for external connections. It can also sometimes be caused by anti-virus software on the client, preventing outgoing connections that haven't been whitelisted, but this is less common.

What is the cause of this problem "IO Error: The Network Adapter could not establish the connection" on Sql Developer?

I make a connection for connect to the Database Server (other machine).
Then I found "An error was encountered performing the requested operation:
IO Error: The Network Adapter could not establish the connection
Vendor code 17002".
Please look the picture in URL below.
I tried to make a connection but can't access but my team can access it.
My friend used TNS connection type and I did everthing similar him but can't access. I tried to use JDBC thin for connect but can't also.
I had the old connection which I can connect but why I can't connect the new connection.
You're trying to connect to a machine on a network that SQL Developer is unable to reach.
For a TNS connection,
Look at the appropriate TNSNames entry (you will have a tnsnames.ora) file, and find the IP address or network name associated with the connection you're trying to establish -
And then start by trying to ping that resource.
In this case, i'm trying to talk to a database on MY machine, on port 1521. Yours should look quite different.
If you're using a basic connection, then you can look at the connection properties and see what machine/port you're trying to communicate with.
Ping
If you can't reach that machine from your machine, there's zero chance you can connect to a database there.
So, always start with a ping.
Once you see that you can get to that machine, if you're still getting that message, the next thing to think about is blocked ports, the listener defaults to port 1521, but you'll see that in the TNS descriptor as well.
It usually happens when a another process is running on the same port or there is an absence of listener.
Go to Run>services.msc>OracleXETNSListener>Start
Try to reconnect.. Even if the error still prevail then go to cmd
Use code:
npx kill-port <portnumber>
The port number by default is 1521, but you can check the port number in database properties.
It is possible, that your connection is forbidden by the firewall -
go to Control Panel\System and Security\Windows Defender Firewall - Advanced - Outbound Rules - Add a rule. (If you have some antivirus firewall, add rules there)
Create a temporary TCP rule for your port and another rule for UDP. Allow all nets and comps.
Check the telnet connection as cmd -> telnet ->
open remote.host.address PortNumber
If you can connect now, then the problem IS in firewall - edit your new rules, setting the hosts and nets exactly.
This error is because your sqldeveloper is not able to reach the database server's sql service.
One reason could be lsnrctl is down for some reason.
If you have access to machine where database is installed.
In Windows machine, follow: https://www.youtube.com/watch?v=r9pHqOfV2f0&ab_channel=TLinaTutorials
In Linux/macOS machine: Go to $ORACLE_HOME/bin and check status of lsnrctl
execute from $ORACLE_HOME/bin lsnrctl status, if it's down. Then restart it by lsnrctl start.
Check the details of connection in command output like SID, PORT, HOST etc. and try connecting again from sqldeveloper.

TeamCity Socket timeout When Creating Database

I am using TeamCity version 10.4. I am trying to create the database on my local machine.
However, I am getting this error:
The connection to the host localhost, named instance hsalman-pc failed. Error: "java.net.SocketTimeoutException: Receive timed out".
Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later,
verify that the SQL Server Browser Service is running on the host.
I have the required driver here:
Aslo, I cannot locate the database properties file in the data directory. So what is the problem?

why do I have problems connecting remotely to oracle?

I'm trying to connect to oracle database on the following ip 192.168.1.1 port 1521
The firewall is off
but I'm still unable to connect i get the following error while using oracle sql developer: "the network adapter could not establish the connection"
The port 1521 is opened since i could connect to it on localhost
any help?
The port 1521 is opened since i could connect to it on localhost
Unless you've configured your listener with multiple addresses, it will only be listening on one, and since you can connect with localhost then it's (only) using that one. You can verify that with lsnrctl status which will show either localhost or 127.0.0.1, but not the external IP address 192.168.1.1.
You need to reconfigure your listener to use 192.168.1.1 instead of, or as well as, localhost before you'll be able to connect to it from anywhere else.

Cannot connect to named instance of SQL Server 2008R2

I am attempting to create a new Database Project in VS2010 via the New Project Wizard, and via this article: http://msdn.microsoft.com/en-us/library/aa833432(v=vs.100).aspx
I am on the 'Configure Build/Deploy' step, and am attempting to connect to a named instance of SQL Server 2008R2 that I just installed, called DEVELOPMENT. Assuming the server name is DB-01, I am using DB-01\DEVELOPMENT as the Server name in the dialog in the screenshot below. I'm also using the remaining settings in the dialog, but it keeps giving me the following error:
A network-related or instance-specific error occurred while
establishing a connection to the SQL Server. The server was not found
or was not accessible. Verify that the instance name is correct and
that SQL Server is configured to allow remote connections. (provider:
TCP Provider, error: 0 - A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to
respond.)
DEV is the name of a database I created on the DEVELOPMENT instance. If I use DB-01 as the server name, which is the default instance, it connects. In the past, we've been developing from a database on the default instance, with no issues, but I'm trying to move to local, source-controlled databases. What am I missing with this not connecting?
EDIT: As a little more context, it's not the username/pw combination, or the existence of the DEV db on the instance, because I receive different errors if either of those are incorrect. It's simply not able to connect once I give it the named instance.
Figured it out:
The default instance of SQL Server (called MSSQLSERVER in some places) uses port 1433 by default for incoming connections, which was opened in Windows Firewall. This is why I was able to connect to the default instance (DB-01). If you've created a named instance of SQL Server, by default these instances use port 1434 for incoming connections. These are TCP ports for each case. Well, I have to admit that I opened TCP port 1434 in Windows Firewall and still was not able to connect to the named instance remotely, and still am not sure why this was the case. So instead, I opened up a random port (6969) in Windows Firewall, and configured the DEVELOPMENT (named) instance to accept incoming connecting over that port only. For instructions on how to configure specific SQL Server instances to use ports other than the default, see this article:
Configure a Server to Listen on a Specific TCP Port
Once I configured the instance to use port 6969, I was able to connect with no issue. Hope this helps others that are having a similar/same issue.

Resources