Buenas a todos...... estoy tratando de usar MySQL en Java y tengo la misma (mala) suerte que con C++ en mi sistema Windows
Al compilar me dice esto:
Cita:
El programa de prueba es ..Compiling JdbcCheckup.java...
JdbcCheckup.java:19: error: package oracle.jdbc.driver does not exist
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
JdbcCheckup.java:19: error: package oracle.jdbc.driver does not exist
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Código Java:
Ver original
/* * This sample can be used to check the JDBC installation. * Just run it and provide the connect information. It will select * "Hello World" from the database. */ // You need to import the java.sql package to use JDBC import java.sql.*; // We import java.io to be able to read from the command line import java.io.*; class JdbcCheckup { { // Load the Oracle JDBC driver // Prompt the user for connect information String user; String password; String database; user = "root"; password = "gogogo"; database = "tiendax"; ("jdbc:oracle:oci8:@" + database, user, password); // Create a statement // Do the SQL "Hello World" thing while (rset.next()) // close the result set, the statement and connect rset.close(); stmt.close(); conn.close(); } // Utility function to read a line from standard input { try { while (c != '\n' && c != -1) { buffer.append((char)c); } return buffer.toString().trim(); } { return ""; } } }
Y compilo usando este batch:
Código BASH:
Ver original
@ECHO OFF cd %~dp1 ECHO Compiling %~nx1... IF EXIST %~n1.class ( DEL %~n1.class ) javac -Xlint:unchecked %~nx1 IF EXIST %~n1.class ( ECHO Running %~n1... java -classpath .;"C:\Program Files\Java\mysql-connectorJ\mysql-connector-java-3.0.17-ga-bin.jar" -ea %~n1 )
Tengo el archivo mysql-connector-java-3.0.17-ga-bin.jar en "C:\Program Files\Java\connectorJ-mysql"
Alguna idea ?
Mil gracias por su tiempo!