• Post Reply Bookmark Topic Watch Topic
  • New Topic

database connection

 
jayashri hosur
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am getting error by running the below code so help me please
Class.forName("oracle.jdbc.driver.OracleDriver");

String url="jdbcracle:thin:@localhost:1521:sid";

System.out.println("urllllllllll"+url);

Connection conn;

try {

conn = DriverManager.getConnection(url,sysusername,syspassword);

System.out.println("connnnnnnnn"+conn);



Statement stmt = conn.createStatement();



} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}





adding classes111.jar and classes12.jar but I am getting this error



Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
 
Yamil Bracho
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you supply a wrong username/password...
 
Paul Clapham
Sheriff
Posts: 21963
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Connection refused" usually means there is no server running at the port you tried to connect to.

In your example, that's port 1521 on localhost. Are you running an Oracle server on the same computer where that code was running? And is it configured to listen at port 1521?
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!