Problem med JDBC
Når jeg kompilerer nedenstående java kode får jeg denne fejl:package oracle.jdbc.driver does not exist
import oracle.jdbc.driver.*;
^
Jeg kører med Oracle V.9 og en gl. JDK V 1.3.1!
import oracle.jdbc.driver.*;
import java.sql.*;
import java.io.*;
class Jdbc
{
public static void main(String args []) throws Exception
{
Class.forName("oracle.jdbc.driver.OracleDriver");
String user, pass;
user=readEntry("Userid: ");
pass=readEntry("Password: ");
Connection conn=DriverManager.getConnection("jdbc:oracle:oci8:"+user+"/"+pass);
Statement stmt=conn.createStatement();
ResultSet rset=stmt.executeQuery("select eno, ename, zip, hdate from employees");
while(rset.next())
{
System.out.println(rset.getString(1)+" ");
}
stmt.close();
conn.close();
}
static String readEntry(String prompt) throws Exception
{
StringBuffer buffer=new StringBuffer();
System.out.println(prompt);
System.out.flush();
int c=System.in.read();
while(c != '\n' && c != -1)
{
buffer.append((char)c);
c=System.in.read();
}
return buffer.toString().trim();
}
}