Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database Connection problem.Help Please

 
Ramesh Lakshmanan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Can anyone show an Light for me , why am i getting the Following Error while trying to connect to the Oracle Database via Oracle Driver.
Error : Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=135294976)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))

My class:

public class InfoCtrDbConnector
{
Connection connection=null;
private Stringdbname="";
private Stringusername="";
private Stringpassword="";
/***************************************************************************
* Contructor for the Class.Database URL , Database name and password
* are retrived from the Property file using Property Manager class.
*
* @param NonParamterezed constructor
**************************************************************************/

public InfoCtrDbConnector() throws Exception
{
this.dbname = "10.200.77.96:1521:WFLOWD1";this.username = "xxxx"; this.password = "xxxx"; }
/***************************************************************************
* getConnection function returns the connection object.Connection object is
* retrived using the Driver Managers getConnection method by passing the
* DB URL,DB name and DB Password.
*
* @param Empty Paramter
* @return Connection-Returns the Connection object.
**************************************************************************/
public Connection getConnection() throws Exception
{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
this.connection=DriverManager.getConnection("jdbc racle:thin:@"+dbname,
username,
password);
return this.connection;
}

/***************************************************************************
* closeConnection function is used to close the Currenet Datbase Connection
* Object.
*
* @param Connection Object Paramter
* @return Returns the Connection object.
**************************************************************************/
public void closeConnection(Connection connection) throws Exception
{
connection.close();
}
}
regards
Ramesh
 
amanda wu
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(dbURL,username,password);
these two lines works for me
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic