Juanator07 de Febrero del 2006
PreguntaEstoy haciendo una aplicacion en java ke se conecte con oracle 9i y siempre me da el siguiente fallo:
Exception in thread "main" java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at driver_check.main(driver_check.java:47)
y no se ke es lo ke esta mal.
He incluido la maquina virtual de java en la ruta del path y no se que hacer mas. Adjunto la pequeña aplicacion de prueba ke uso
import java.io.* ;
import java.sql.* ;
import oracle.jdbc.driver.* ;
class driver_check {
public static void main (String args [])
throws SQLException, IOException
{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Prompt the user for connect information
System.out.println ("Enter test connect info ");
String user;
String password;
String database;
user = readEntry ("user: ");
int slash_index = user.indexOf ('/');
if (slash_index != -1)
{
password = user.substring (slash_index + 1);
user = user.substring (0, slash_index);
}
else
password = readEntry ("password: ");
database = readEntry ("database (a TNSNAME entry): ");
System.out.print ("Connecting to the database...");
System.out.flush ();
System.out.println ("Connecting...");
Connection conn =
DriverManager.getConnection ("jdbc:oracle:thin:" + user + "/" + password + "@" + database);
System.out.println ("connected.");
// Create a statement
Statement stmt = conn.createStatement ();
// Do the SQL "Hello World" thing
ResultSet rset = stmt.executeQuery ("select 'Hello World' from dual");
while (rset.next ())
System.out.println (rset.getString (1));
// close the result set, the statement and connect
rset.close();
stmt.close();
conn.close();
System.out.println ("Your JDBC installation is correct.");
}
// Utility function to read a line from standard input
static String readEntry (String prompt)
{
try
{
StringBuffer buffer = new StringBuffer ();
System.out.print (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 ();
}
catch (IOException e)
{
return "";
}
}
}
Doy las gracias de antemano al ke kiera perder su tiempo ayudandome. Agradezco cualquier minima ayuda porke estoy amargao con esto ke no le encuentro el fallo
Exception in thread "main" java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at driver_check.main(driver_check.java:47)
y no se ke es lo ke esta mal.
He incluido la maquina virtual de java en la ruta del path y no se que hacer mas. Adjunto la pequeña aplicacion de prueba ke uso
import java.io.* ;
import java.sql.* ;
import oracle.jdbc.driver.* ;
class driver_check {
public static void main (String args [])
throws SQLException, IOException
{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Prompt the user for connect information
System.out.println ("Enter test connect info ");
String user;
String password;
String database;
user = readEntry ("user: ");
int slash_index = user.indexOf ('/');
if (slash_index != -1)
{
password = user.substring (slash_index + 1);
user = user.substring (0, slash_index);
}
else
password = readEntry ("password: ");
database = readEntry ("database (a TNSNAME entry): ");
System.out.print ("Connecting to the database...");
System.out.flush ();
System.out.println ("Connecting...");
Connection conn =
DriverManager.getConnection ("jdbc:oracle:thin:" + user + "/" + password + "@" + database);
System.out.println ("connected.");
// Create a statement
Statement stmt = conn.createStatement ();
// Do the SQL "Hello World" thing
ResultSet rset = stmt.executeQuery ("select 'Hello World' from dual");
while (rset.next ())
System.out.println (rset.getString (1));
// close the result set, the statement and connect
rset.close();
stmt.close();
conn.close();
System.out.println ("Your JDBC installation is correct.");
}
// Utility function to read a line from standard input
static String readEntry (String prompt)
{
try
{
StringBuffer buffer = new StringBuffer ();
System.out.print (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 ();
}
catch (IOException e)
{
return "";
}
}
}
Doy las gracias de antemano al ke kiera perder su tiempo ayudandome. Agradezco cualquier minima ayuda porke estoy amargao con esto ke no le encuentro el fallo
