• 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: 20983
31
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic