Liandro,
O c�digo do erro � o TNS-12505, que est� assim descrito no Oracle Error Messages Manual:
TNS-12505 TNS:listener could not resolve SID given in connect descriptor
Cause: The SID in CONNECT_DATA was not found in the listener's tables.
Action: Check to make sure that the SID specified is correct. The SIDs that are currently registered with the listener can be obtained by typing "LSNRCTL SERVICES listener_name". These SIDs correspond to SID_NAMEs in TNSNAMES.ORA, or DB_NAMES in the INIT.ORA file.
Verifique o que est� sendo pedido e entre contato caso vc precise de ajuda. A princ�pio, o seu problema n�o tem nada relacionado ao JDBC, e sim a configura��o do listener do banco de dados.
[]s
Maiko
[EMAIL PROTECTED] escreveu:
Ol�...Bem, est� � a situa��o, tenho um banco de dados ORACLE, com dois ALIASo UNPD e o UNPS, o UNPD esta trabalhando normalmente com conexao do tipo dedicadae o UNPS foi configurado p/ conexao do tipo SHARED, pelo sqlplus acontece conexao comos dois alias normalmente, mas com qualquer classes java que utilize o JDBC 1.x, 2.x ,tentando uma simples conexao ela s� acontece com o alias UNPD, que esta em producao ha anosmas com o UNPS acontece um erro gerado no momento em que tento uma conexao...o erro esta abaixo, eu nao consiguo identificar o motivo ou os codigos gerados..Algu�m pode ajudar???obrigado.========================= ERRO gerado*** Java Stack Trace ***java.sql.SQLException: Exce��o de I/O: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=135291648)(ERR=12
505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:210)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:251)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at Jdbctest.main(Jdbctest.java:54)*** SQLException caught ***SQLState: null
Message: Exce��o de I/O: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=135291648)(ERR=12505)(ERROR_ST
ACK=(ERROR=(CODE=12505)(EMFI=4))))
Error Code: 17002=========================== Classe Jdbctest
import java.sql.*;
public class Jdbctest {
public static void main (String args[]) {
try {
/* This produces more output then suitible for this article */
/* Uncomment the next line for more connect information */
// DriverManager.setLogStream(System.out);
/*
* Set the host port and sid below to
* match the entries in the listener.ora
* Must have a SCOTT/TIGER schema
*/
String host = "100.100.100.10"; // change,these won't work
String port = "1521";
String sid = "unps";
// or pass on command line all three items
if ( args.length >= 3 ) {
host = args[0];
port = args[1];
sid = args[2];
}String s1 = "jdbc:oracle:thin:@" +
host + ":" +
port + ":" +
sid ;if ( args.length == 1 ) {
s1 = "jdbc:oracle:oci8:@" +
args[0];
}System.out.println( args.length );if ( args.length == 4 ) {System.out.println( "\np1" );
s1 = "jdbc:oracle:" + args[3] + ":@" +
"(description=(address=(host=" + host+
")(protocol=tcp)(port=" + port+
"))(connect_data=(sid=" + sid +
")))";
}
System.out.println( "Connecting with: " );
System.out.println( s1 );DriverManager.registerDriver(
new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection( s1,
"web",
"web");DatabaseMetaData dmd = conn.getMetaData();
System.out.println("DriverVersion: ["+
dmd.getDriverVersion()+"]");
System.out.println("DriverMajorVersion: ["+
dmd.getDriverMajorVersion()+"]");
System.out.println("DriverMinorVersion: ["+
dmd.getDriverMinorVersion()+"]");
System.out.println("DriverName: ["+
dmd.getDriverName()+"]");if ( conn!=null )
conn.close();
System.out.println("Done.");} catch ( SQLException e ) {
System.out.println ("\n*** Java Stack Trace ***\n");
e.printStackTrace();System.out.println ("\n*** SQLException caught ***\n");
while ( e != null ) {
System.out.println ("SQLState: " + e.getSQLState ());
System.out.println ("Message: " + e.getMessage ());
System.out.println ("Error Code: " + e.getErrorCode ());
e = e.getNextException ();
System.out.println ("");
}
}
}
}=============================Liandro - Unimed de Londrinaicq - 53456279
Yahoo! Empregos
O trabalho dos seus sonhos pode estar aqui. Cadastre-se hoje mesmo no Yahoo! Empregos e tenha acesso a milhares de vagas abertas!
