If you’re here because you downloaded a copy of Oracle SQL Developer and now you need help connecting to a database, then you’re in the right place.
I’ll show you what you need to get up and going so you can finish your homework, teach yourself Oracle database, or get ready for that job interview. You’ll need about 30 minutes to set everything up…and about 5 years to become proficient with Oracle 😉
Oracle Database come with SQL Developer but SQL Developer doesn’t include a database
But I’m here to talk to the folks that have downloaded SQL Developer and want to know what to do next.
You’ve got it running. You see this ‘Connection’ dialog, and…
You NEED a database
Installing SQL Developer does not give you a database. So you’re going to need to install Oracle and create a database, or connect to a database that is already up and running somewhere. Basically you need to know the following: where is this database, what’s it called, and what port is the listener running on?
These default settings CAN work, but ONLY if you have installed Oracle Database Express Edition (XE).
Localhost is a network alias for 127.0.0.1 which is an IP address that maps to the ‘local’ machine, or the machine you are reading this blog post on.
The listener is a service that runs on the server and handles connections for the databases on that machine. You can run a database without a listener and you can run a listener without a database, but you can’t connect to a database on a different server unless both that database and listener are up and running. Each listener ‘listens’ on one or more ports, you need to know the port number for each connection. The default port is 1521, but 1522 is often pretty common.
I know all of this sounds very complicated
Oracle is a very sophisticated piece of software. It’s not analogous to downloading a mobile phone app and and using it 10 seconds later. It’s not like installing Office/Access either – it requires services, environment setup, kernel tweaks, etc.
Normally an administrator will setup and install Oracle, create the database, and configure the listener for everyone else to use. They’ll often also setup the connection details for everyone via a ‘TNSNAMES.ORA’ file. This file contains a list of database connection details for folks to browse – kind of like an Oracle database phoneboook.
If someone has given you a TNSNAMES.ORA file, or setup your machine to have access to a TNSNAMES file, then you can just switch to the ‘TNS’ connection type, and use the dropdown to select the database you want to connect to. Then you don’t have to worry about the server names, database names, and the port numbers.
It’s just me, and I need help!
No administrator, no database, no nothing. What do you do?
You have a few options:
- Buy a copy of Oracle and download, install, and create a database
- Download and install XE (FREE!)
- Download, import, and run our Developer Days Hands-on-Lab (FREE!)
If you’re a student (or anyone else) with little to no experience with Oracle, then I recommend the third option.
Oracle Technology Network Developer Day: Hands-on Database Application Development Lab
The OTN lab runs on a A Virtual Box image which contains:
- 11gR2 Enterprise Edition copy of Oracle
- a database and listener running for you to connect to
- lots of demo data for you to play with
- SQL Developer installed and ready to connect
- Some browser based labs you can step through to learn Oracle
You then ‘Start’ the image. It will boot a copy of Oracle Linux, start your database, and all that jazz. You can then start up and run SQL Developer inside the image OR you can connect to the database running on the image using the copy of SQL Developer you installed on your host machine.
Setup Port Forwarding to Make It Easy to Connect From Your Host
When you start the image, it will be assigned an IP address. Depending on what network adapter you select in the image preferences, you may get something that can get out to the internet from your image, something your host machine can see and connect to, or something that kind of just lives out there in a vacuum. You want to avoid the ‘vacuum’ option – unless you’re OK with running SQL Developer inside the Linux image.
Open the Virtual Box image properties and go to the Networking options. We’re going to setup port forwarding. This will tell your machine that anything that happens on port 1521 (the default Oracle Listener port), should just go to the image’s port 1521. So I can connect to ‘localhost’ and it will magically get transferred to the image that is running.
Now You Just Need a Username and Password
The default passwords on this image are all ‘oracle’ – so you can connect as SYS, HR, or whatever – just use ‘oracle’ as the password. The Linux passowrds are all ‘oracle’ too, so you can login as ‘root’ or as ‘oracle’ in the Linux desktop.
If you’re connecting to someone else’s database, you need to ask the person that manages that environment to create for you an account. Don’t try to ‘guess’ or ‘figure out’ what the username and password is. Introduce yourself, explain your situation, and ask kindly for access.
This is your first test – can you connect?
I know it’s hard to get started with Oracle. There are however many things we offer to make this easier. You’ll need to do a bit of RTM first though. Once you know what’s required, you will be much more likely to succeed. Of course, if you need help, you know where to find me 🙂