Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC Error :- End of TNS data Channel. SQL Exception Error

 
Shantanu Gangakhedkar
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,
I am trying to use Type 4 JDBC Drivers :- 816classes12b.zip oracle Drivers for Connectivity
with Oracle database My Program works fine with same database with ODBC Bridge Drivers and
same TNS Name. I am using 8.0.3.0.0 oracle enterprise version. Please tell me the URL of any
compatible drivers for oracle version.
My Code is :-

public Database(String pstrUserID, String pstrPasswd) {
this.mstrUserID = "scott"; //pstrUserID;
this.mstrPasswd = "tiger"; //pstrPasswd;
SID = "ORCL"; //"ORCL";
DBServer = "cilbank";
DBPort = 1521;

// mstrjdbcURL = jdbc racle:thin:@"+DBServer+":"+DBPort+":"+SID;
mstrjdbcURL="jdbc racle:thin:@cilbank:1521:ORCL";
//mstrjdbcURL = "jdbc dbc racleback";
System.out.println (mstrjdbcURL);
}
private Connection getConnection () throws SQLException {
try {
Class.forName ("oracle.jdbc.driver.OracleDriver");
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("User ID :"+mstrUserID);
System.out.println("Password :"+mstrPasswd);
con = DriverManager.getConnection(mstrjdbcURL,"scott","tiger");
return con;
}
catch (ClassNotFoundException cnfExc) {
throw new SQLException ("Path for driver classes not set properly.");
}
}
public void mOpenConnection () throws SQLException {
if (con != null && !con.isClosed())
return;
try {
con = this.getConnection ();
}
catch (SQLException sqlExc) {
sqlExc.printStackTrace();
throw new SQLException ("Fatal
Error!Error while connecting to database. "+sqlExc.getMessage () + "|----|" + sqlExc.getErrorCode());
}
if (con == null)
throw new SQLException ("Driver not found.");
con.setAutoCommit (false);
}
When i Execute my class it gives following SQLException End of TNS data channel.
I am not getting this problem.I am returing errorcode also but it gives 0 means there is no problem
EXCEPTION :-
jdbc racle:thin:@cilbank:1521:ORCLUser ID :scott
Password :tigerjava.sql.SQLException: End of TNS data channelat oracle.jdbc.dbaccess.DBError.check_error(DBError.java:406)at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:169)at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:231)at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:208)at java.sql.DriverManager.getConnection(Compiled Code)at java.sql.DriverManager.getConnection(DriverManager.java:137)at Database.getConnection(Database.java:56)at Database.mOpenConnection(Database.java:67)at Database.main(Compiled Code)Exception:Fatal Error!Error while connecting to database. End of TNS data channel|----|0Process Exit...

Please any body help me in this.
Thanx in Advance.
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The End of channel error is an error originating from the database/network and not your java code. You need to check with your DBA to ensure that your URL is correct. If it is, the problem could also be generated if there is more than one entry on the domain server for the domain name (or a conficting enrty in your host file).
[This message has been edited by Carl Trusiak (edited June 18, 2000).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic