I am trying to work on a project for school from home. The school computer has Oracle and I am trying to access it from home using Java/JSP. Currently I have Java SE with NetBeans installed on my home machine (Windows XP SP II), but not Tomcat or Oracle. The database that I am accessing is stored completely on the Oracle machine at school. One question I have is, given that, must I install Oracle at home too in order to get these JDBC drivers or do the drivers come with Java?
Researching the web, the solutions have involved setting up path and classpath with directories including ORACLE_HOME, which I believe does not exist on my computer since I have not installed Oracle. Here is the code I have written:
// Filename : DeptTableInteraction.java
package DBinteraction;
import java.sql.* ;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import java.lang.*;
public class DeptTableInteraction
{
public DeptTableInteraction ()
{
System.out.println ("So Far So Good 1\n");
try
{
System.out.println ("So Far So Good 2\n");
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println ("So Far So Good 3\n");
}
catch (ClassNotFoundException ex)
{
System.out.println ("Something Bad Happened\n");
}
}
public static void main(String[] args) throws SQLException
{
DeptTableInteraction dti = new DeptTableInteraction();
}
}
It compiles. The results are the following after compiling/running through NetBeans:
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\Bob\NetbeansProjects\Java\DeptTableInteraction\build\classes
compile:
So Far So Good 1So Far So Good 2
Something Bad Happened
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]
debug:
BUILD SUCCESSFUL (total time: 1 second)
So the questions are:
1) Do I need to install Oracle on my local machine even though the database is stored elsewhere?
2) Where does this driver come from (Oracle or Sun)?
Thank you.