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 database connection 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 "database connection" Watch "database connection" New topic

database connection

jayashri hosur

Joined: Jun 05, 2008
Posts: 8
i am getting error by running the below code so help me please

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


Connection conn;

try {

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


Statement stmt = conn.createStatement();

} catch (SQLException e) {

// TODO Auto-generated catch block



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

Joined: Mar 24, 2004
Posts: 1
It looks like you supply a wrong username/password...
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

"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?
I agree. Here's the link:
subject: database connection
It's not a secret anymore!