Hello I have a problem trying to use oracle database from Java I can not make connection from Java to Oracle by the Thin nither Oci8 options using the import java.sql.*. To this proposs I use 2 simple java programs (attacheds). Them compiles well but when I try to run I obtains the errors bellow: could some body helpme please! Sincerly Bernardo WHITH THIN OPTION: [paz@ javajobs]$ java ThinConn java.sql.SQLException: Refused:ROR=(CODE=12500)(EMFI=4))(ERROR=(CODE=12546)(EMFI=4)) (ERROR=(CODE=12560)(EMFI=4))(ERROR=(CODE=516)(EMFI=4)) (ERROR=(BUF='Linux Error: 13: Permission denied')))) at java/lang/Throwable.<init>(30) at java/lang/Exception.<init>(21) at java/sql/SQLException.<init>(90) at oracle/jdbc/dbaccess/DBError.check_error(228) at oracle/jdbc/driver/OracleConnection.<init>(110) at oracle/jdbc/driver/OracleDriver.connect(148) at java/sql/DriverManager.getConnection(90) at java/sql/DriverManager.getConnection(132) at ThinConn.main(24) [paz@ javajobs]$ WHITH OCI8 OPTION: [paz@ javajobs]$ java Oci8Conn java.lang.UnsatisfiedLinkError: oci805jdbc at java/lang/Throwable.<init>(30) at java/lang/Error.<init>(21) at java/lang/LinkageError.<init>(21) at java/lang/UnsatisfiedLinkError.<init>(21) at java/lang/Runtime.loadLibrary(125) at java/lang/System.loadLibrary(90) at oracle/jdbc/oci7/OCIDBAccess.logon(142) at oracle/jdbc/driver/OracleConnection.<init>(103) at oracle/jdbc/driver/OracleDriver.connect(148) at java/sql/DriverManager.getConnection(90) at java/sql/DriverManager.getConnection(132) at Oci8Conn.main(21) [paz@ javajobs]$
/* * This sample shows how to list all the names from the EMP table * * It uses the JDBC THIN driver. See the same program in the * oci7 or oci8 samples directories to see how to use the other drivers. */ // You need to import the java.sql package to use JDBC import java.sql.*; import java.math.*; class ThinConn { public static void main (String args []) throws SQLException { // Load the Oracle JDBC driver DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); // Connect to the database // You must put a database name after the @ sign in the connection URL. // You can use either the fully specified SQL*net syntax or a short cut // syntax as <host>:<port>:<sid>. The example uses the short cut syntax. Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@.zuriqui:1521:DBI", "bpazb", "paz"); // Create a Statement Statement stmt = conn.createStatement (); // Select the NUMERO column from the PRUEBA table ResultSet rset = stmt.executeQuery ("select NUMERO from PRUEBA"); // Iterate through the result and print the employee names while (rset.next ()) System.out.println (rset.getString (1)); } }
/* * This sample shows how to list all the names from the PRUEBA table * * It uses the JDBC OCI8 driver. See the same program in the * thin or oci7 samples directories to see how to use the other drivers. */ // You need to import the java.sql package to use JDBC import java.sql.*; class Oci8Conn { public static void main (String args []) throws SQLException, ClassNotFoundException { // Load the Oracle JDBC driver Class.forName ("oracle.jdbc.driver.OracleDriver"); // Connect to the database // You can put a database name after the @ sign in the connection URL. Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@1.2.3.4", "bpazb", "paz"); // Create a Statement Statement stmt = conn.createStatement (); // Select the NUMERO column from the PRUEBA table ResultSet rset = stmt.executeQuery ("select NUMERO from PRUEBA"); // Iterate through the result and print the employee names while (rset.next ()) System.out.println (rset.getString (1)); } }
______________________________ Dr. Bernardo Paz Betancourt TROPANDES Project casilla 415 tel/Fax: (591) 2 41.18.34 http://www.megalink.com/tropandes La Paz - Bolivia