Galera,
boa tarde.
Estou com um problema meio estranho.
Estou fazendo uma conexão oracle no Java utilizando o driver ojdbc14.jar.
A grande zica é que ele não dá exception, ele passa pela conexão porém seta a variável de conexão como nula.
Vejam o código:
public static Connection getConnection(){
//Oracle
try {
String driverName = "oracle.jdbc.driver.OracleDriver";
String serverName = "999.999.99.99";
String portNumber = "1521";
String mydatabase = serverName + ":" + portNumber;
String database = "teste";
String url = "jdbc:oracle:thin:@" + mydatabase +":" + database;// a JDBC url
String username = "teste";
String password = "teste";
// Load the JDBC driver
Class.forName(driverName);
// Create a connection to the database
connection = DriverManager.getConnection(url, username, password);
} catch (ClassNotFoundException e) {
// Could not find the database driver
} catch (SQLException f) {
// Could not connect to the database
}
return connection;
}
Alguém sabe o que possa ser?
Agradeço a atenção!!
Vinicius!!!