Long time working with the Raspberry Pi and having a lot of interfaces I didn’t find anywhere how to make requested to the Oracle DB from the OS Raspbian.

Here are my experiences:

Install Raspbian as usual. There is thousand of how to all around.

Install Java SDK (I’m not a fan of Java… But I didn’t find another system.)  The OCI libraries from Oracle doesn’t work on ARM architectures. Now Java SDK is in the raspbian repositories.

I’ve been using Instant Client from Oracle on Debian host without problems but there are not drivers for Raspbian yet.

I’m using always root to avoid using sudo for all commands!

[bash]root@host:~# apt-get install oracle-java7-jdk[/bash]

Get the ojdbc7 driver from Oracle

Test that java is working well with:

[bash]root@host:~# java -version
java version “1.7.0_40”
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) Client VM (build 24.0-b56, mixed mode)[/bash]

Write a file Conn.java with the following code:

import java.sql.*;
class Conn {
public static void main (String[] args) throws Exception
Class.forName ("oracle.jdbc.OracleDriver");

Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@//ip_or_dns_name_of_oracle_server:port_server/SID_Database", "login_database", "password_database");
                // @//machineName:port/SID,   userid,  password
try {
  Statement stmt = conn.createStatement();
  try {
    ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
    try {
      while (rset.next())
        System.out.println (rset.getString(1));   // Print colon 1
    finally {
      try { rset.close(); } catch (Exception ignore) {}
  finally {
    try { stmt.close(); } catch (Exception ignore) {}
  finally {
    try { conn.close(); } catch (Exception ignore) {}

Now, you can compile with:

[bash]javac  Conn.java[/bash]

and run with:

[bash]java -cp /wherever_you_put_the_file/ojdbc7.jar:. Conn[/bash]