Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having great difficulty making a connection to an Oracle Database OJDBC.
I´m using Google Web Toolkit and i added a SQL Database to my project. The Database name is Agenda.

I've searched a lot, it seems this problem is common to many people, but could not overcome this problem. I've downloaded "ojdbc6.jar" and added to my BUILDPATH. I've refreshed, close, open and reopen, but I still see errors.

My Specs: Windows 7 x64 Springsource - tried also in Eclipse Database - Oracle 10.2.0 and the database is attached to my source project under com.gwt.agenda

private static final long serialVersionUID = 1L;
private Connection connection = null;
private Properties props = null;
private ClassLoader cl = null;
private String databaseURL = "";
private String databaseUser = "";
private String databasePass = "";
public void init() {
    try {
        // Load the database connection properties from
        props = new Properties();
        cl = this.getClass().getClassLoader();
        InputStream is = cl.getResourceAsStream("com/gwt/agenda/");
        // Load the database access information
        databaseURL = props.getProperty("databaseURL");
        databaseUser = props.getProperty("databaseUser");
        databasePass = props.getProperty("databasePass");
    } catch (Exception e) {
        logger.error("Error loading file.", e);
    try {
        // Connect to the database
        connection = DriverManager.getConnection(databaseURL, databaseUser, databasePass);
    } catch (SQLException se) { messageOut = "Unable to connect to database. Exception message: " + se.getMessage();
        // Server side log
        logger.error(messageOut + "\n", se);
    } catch (Exception e) {
        messageOut = "Unable to connect to database. Exception message: " + e.getMessage();
        // Server side
        logger.error(messageOut + "\n", e);

Unable to connect to database. Exception message: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

databaseURL=jdbc:oracle:thin:@hp-PC:1521:xe databaseUser=user databasePass=agenda Where @hp-PC is my computer name

Can someone point me in the right direction. Am i missing something?

Please help!

share|improve this question

change your computer name to host in listner.ora file and tnsname.ora file where ur oracle installed folder such as db_1-network-admin-you will get .ora file and change your host to if yours is local machine,and port to 1521.. try this out

and xe you mentioning it should be your sid,,check this also

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.