File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JDBC Error :- End of TNS data Channel. SQL Exception Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC Error :- End of TNS data Channel. SQL Exception Error" Watch "JDBC Error :- End of TNS data Channel. SQL Exception Error" New topic

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

Shantanu Gangakhedkar

Joined: Jan 19, 2000
Posts: 15
Hello Friends,
I am trying to use Type 4 JDBC Drivers :- 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 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");
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())
try {
con = this.getConnection ();
catch (SQLException sqlExc) {
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
jdbc racle:thin:@cilbank:1521:ORCLUser ID :scott
Password :tigerjava.sql.SQLException: End of TNS data channelat oracle.jdbc.dbaccess.DBError.check_error( oracle.jdbc.driver.OracleConnection.<init>( oracle.jdbc.driver.OracleDriver.getConnectionInstance( oracle.jdbc.driver.OracleDriver.connect( java.sql.DriverManager.getConnection(Compiled Code)at java.sql.DriverManager.getConnection( Database.getConnection( Database.mOpenConnection( 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

Joined: Jun 13, 2000
Posts: 3340
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).]

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
I agree. Here's the link:
subject: JDBC Error :- End of TNS data Channel. SQL Exception Error
It's not a secret anymore!