views:

362

answers:

1

Hi all,

I have a problem with JDBC Thin in Oracle 11g with NetBeans V6.7.1. I don't know how to configure it. I have already set classpath of ojdbc6.jar and orai18n.jar. But I still can't run this example in NetBeans:

import java.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.pool.OracleDataSource;
class JDBCVersion
{
    public static void main (String args[]) throws SQLException
    {
        OracleDataSource ods = new OracleDataSource();
        ods.setURL("jdbc:oracle:thin:easycash/oracle@oracle:1521/validus");
        Connection conn = ods.getConnection();
        // Create Oracle DatabaseMetaData object
        DatabaseMetaData meta = conn.getMetaData();
        // gets driver info:
        System.out.println("JDBC driver version is " + meta.getDriverVersion());
    }
}

Could anyone help finish my work?

Thanks, Sopolin

A: 

Try this:

class JDBCVersion
{
    public static void main (String args[]) throws SQLException
    {
        OracleDataSource ods = new OracleDataSource();
        ods.setURL("jdbc:oracle:thin:@oracle:1521:validus");
        ods.setUser("easycash");
        ods.setPassword("oracle");
        Connection conn = ods.getConnection();
        // Create Oracle DatabaseMetaData object
        DatabaseMetaData meta = conn.getMetaData();
        // gets driver info:
        System.out.println("JDBC driver version is " + meta.getDriverVersion());
    }
}

Did you have the oracle-dms.jar in your Classpath?

t1234h
I don't have. Could you tell why?
Sopolin
my Oracle-Driver was complaining about missing DMS-classe
t1234h