tags:

views:

346

answers:

1

I have placed the ojdbc14.jar in the lib folder and am using the code below to connect to oracle:

import java.sql.Connection
import java.sql.DriverManager
import javax.sql.DataSource
import groovy.sql.Sql
import oracle.jdbc.driver.OracleTypes

driver = oracle.jdbc.driver.OracleDriver
Connection conn = DriverManager.getConnection(
    'jdbc:oracle:thin:ratan/rabin123@localhost:1522:orcl');

but get the error: unable to resolve class oracle.jdbc.driver.OracleTypes

+1  A: 

I've checked the code on my computer and it worked, so it has to be a classpath issue.

Is port 1522 correct? It's 1521 by default.

Have you tried to create a connection using the groovy.sql.Sql class:

Sql sql = Sql.newInstance("jdbc:oracle:thin:@localhost:1522:orcl",
    "ratan", "rabin123", "oracle.jdbc.OracleDriver")
Christoph Metzendorf