title: Oracle Database 12c in VM on Mac OSX
body: <p>I'm attempting to get a development environment up and running on my OSX laptop, creating JSPs within Eclipse, running with a Tomcat server, and connecting to an Oracle database.</p>
  
  <p>Eclipse and Tomcat are playing nice together, and I can make JSPs and so forth.  The hard part now is getting an Oracle database up and running on Mountain Lion, and getting Eclipse to connect to it.</p>
  
  <p>After <em>extensive</em> Googling, I have found a number of resources:</p>
  
  <p><a href="http://dimitrisli.wordpress.com/2012/08/08/how-to-install-oracle-database-on-mac-os-any-version/" rel="nofollow noreferrer">http://dimitrisli.wordpress.com/2012/08/08/how-to-install-oracle-database-on-mac-os-any-version/</a>
  <a href="http://barrymcgillin.blogspot.com/2011/12/using-oracle-developer-days-virtualbox.html" rel="nofollow noreferrer">http://barrymcgillin.blogspot.com/2011/12/using-oracle-developer-days-virtualbox.html</a></p>
  
  <p>(or even <a href="https://docs.google.com/document/d/1Th5MSIhS13YIJYCD8W1GLnOQEfrfov-92-He1cluTec/pub" rel="nofollow noreferrer">https://docs.google.com/document/d/1Th5MSIhS13YIJYCD8W1GLnOQEfrfov-92-He1cluTec/pub</a>)</p>
  
  <p>Following these (rather thorough) guides, I have downloaded the latest Virtual Machine from Oracle, here:
  <a href="http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html" rel="nofollow noreferrer">http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html</a></p>
  
  <p><strong>Note: All three of the above tutorials use a slightly older version of the VM, which has Oracle DB 10 or 11, but the one available now is 12c.  The new one also has a different version of Oracle Linux, and probably some other differences.  Various usernames and passwords seem to be slightly different.</strong></p>
  
  <p>I installed VirtualBox, loaded in the VM, brought it online.  I have the Network settings configured with just a NAT adapter, with the adapter type as "PCnet-FAST III", and port forwarding from 127.0.0.1 to 10.0.4.15 on port 1521 to 1521 and 2222 to 22.</p>
  
  <p>Now, if I open Terminal on my host machine, I can SSH into my VM via: <code>ssh -p 2222 oracle@localhost</code>.  I get the Terminal in the VM, and it gives me the same welcome message I get when I first boot up the VM in VirtualBox.  Also, I can ping localhost or 127.0.0.1 and it responds with a variable but short lag.</p>
  
  <p>Based on this I can only assume that my VM is working, and that my port forwarding (which is laid out in all 3 of the tutorials I linked to up there) is in good shape.</p>
  
  <p>Now comes the part where I would want to connect Eclipse to the Oracle database that's within the VM.  If you look under the first tutorial, <a href="https://stackoverflow.com/users/185723/dimitrisli">dimitrisli</a> sets up IntelliJ with a datasource pointing to the VM.  I want to do the same within Eclipse.</p>
  
  <p>I am new to Eclipse, so I looked around for exactly how to do this, and I came up with:</p>
  
  <p><em>1) Make a new Database Driver.</em></p>
  
  <p>I downloaded the JDBC for Oracle Database 12c, JDK 7, from Oracle, <a href="http://www.oracle.com/technetwork/database/features/jdbc/jdbc-drivers-12c-download-1958347.html" rel="nofollow noreferrer">here</a>.  I stuck the .jar file in my Documents folder (in case that's wrong).  Within Eclipse I made a new Database Driver, based off one of the other Oracle Driver templates, and changed the settings.  Under "Driver Files" I pointed to my <code>ojdbc7.jar</code> file, and under "Properties" I have the following--let me know if this is wrong:</p>
  
  <pre><code>Catalog: USER
  Connection URL: jdbc:oracle:thin:@localhost:1521:orcl
  Database Name: pdb1
  Driver Class: oracle.jdbc.OracleDriver
  Password:
  User ID:
  </code></pre>
  
  <p>I tried to use what came in the Oracle Driver template and just tweak to match my exact scenario (based on what was said in the walkthroughs and what I could divine from poking around the modern version of the VM).</p>
  
  <p><em>2) Make a new Database Connection.</em></p>
  
  <p>When I go to make a new Database Connection, I go to the Driver Properties area, and I can pick my custom Driver.  There is also a Properties field, which I enter the following into: (some of it seems to overwrite or duplicate what I typed in when I made the Driver itself?)</p>
  
  <pre><code>SID: orcl
  Host: 127.0.0.1
  Port Number: 1521
  User Name: hr // Gotten from one of the tutorials.  Have also tried 'system/oracle', neither works yet.
  Password: oracle
  Connection URL: jdbc:oracle:thin:@127.0.0.1:1521:orcl // Immutable, set by the Driver I suppose.
  Catalog: User
  </code></pre>
  
  <p>When I click Test Connection, it hangs for a while and then I get a 'Ping failed!' error, with details:</p>
  
  <pre><code>java.sql.SQLRecoverableException: IO Error: Socket read timed out
      at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:673)
      at oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:715)
      at oracle.jdbc.driver.T4CConnection.&lt;init&gt;(T4CConnection.java:385)
      at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
      at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:564)
      at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.createConnection(JDBCConnection.java:298)
      at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:105)
      at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:54)
      at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:81)
      at org.eclipse.datatools.enablement.internal.oracle.JDBCOracleConnectionFactory.createConnection(JDBCOracleConnectionFactory.java:27)
      at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)
      at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:359)
      at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)
      at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)
      at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
  Caused by: oracle.net.ns.NetException: Socket read timed out
      at oracle.net.ns.Packet.receive(Packet.java:350)
      at oracle.net.ns.NSProtocolStream.negotiateConnection(NSProtocolStream.java:153)
      at oracle.net.ns.NSProtocol.connect(NSProtocol.java:263)
      at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1360)
      at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:486)
      ... 14 more
  </code></pre>
  
  <p>Unfortunately, being new to Java and Eclipse and Oracle DB, I'm not quite sure what to do with this, and I have been poking around for several hours trying to determine what could be wrong.  I'm hoping someone with some experience on this can point me in the right direction.</p>
  
  <p>(Oh, and I'm not an inexperienced developer--just new to these tools.)</p>
  
  <p>Thanks!</p>