|
Amigos, criei uma classe para conectar o Oracle e esta dando
problemas. Alguem poderia me sugerir como corrigir?
class Conectar {
String strUrl;
String strUsuario; String strSenha; Connection conexao; public Connection conexaoUniban(boolean blnConexaoParaProducao) { if (blnConexaoParaProducao == true) { this.strUrl = "jdbc: odbc: TESTE_MC"; this.strUsuario = "teste"; this.strSenha = "teste"; } else if (blnConexaoParaProducao == false) { this.strUrl = "jdbc: odbc: TESTE_DESENV"; this.strUsuario = "testedesenv"; this.strSenha = "testedesenv"; } Class.forName("oracle.jdbc.driver.OracleDriver"); conexao = DriverManager.getConnection(this.strUrl, this.strUsuario, this.strSenha); return conexao; } public Conectar () { } } O erros foram os seguintes na compila��o:
OlaInternet.java:27: unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown Class.forName("oracle.jdbc.driver.OracleDriver"); ^ OlaInternet.java:28: unreported exception java.sql.SQLException; must be caught or declared to be thrown conexao = DriverManager.getConnection(this.strUrl, this.strUsuario, this.strSenha); Agrade�o desde j� pela ajuda
Jefferson |
- Re: [java-list] Problemas com conexao Jefferson Prestes
- Re: [java-list] Problemas com conexao Luiz Fernando
- Re: [java-list] Problemas com conexao Luiz Fernando
- Re: [java-list] Problemas com conexao Jefferson Prestes
- Re: [java-list] Problemas com conexao rodrigobrossi
- Re: [java-list] Problemas com conexao Jefferson Prestes
- Re: [java-list] Problemas com conexao Lincolm Ferreira de Aguiar
- Re: [java-list] Problemas com conexao Marco Campelo
