wood burning stoves 2.0*
The moose likes JDBC and the fly likes database connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "database connection" Watch "database connection" New topic
Author

database connection

jayashri hosur
Greenhorn

Joined: Jun 05, 2008
Posts: 8
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

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

Joined: Oct 14, 2005
Posts: 18541
    
    8

"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?
 
 
subject: database connection
 
Similar Threads
Class.forName("")
JDBC/Oracle access problem
java lang NoClassDefFoundError
connecting to Webtrends reporting DB using JDBC-ODBC
jdbc