cannot find symbol DriverManager

satyashil_at_exact-solutions.com
Date: 12/16/04


Date: 16 Dec 2004 11:29:19 -0800

I am trying to execute following program:

mport java.util.Properties;
import java.util.ResourceBundle;
import java.util.Enumeration;
import java.util.ArrayList;
import java.io.IOException;
import java.sql.CallableStatement;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.Types;
import java.sql.ResultSet;
import java.sql.SQLException;

class OraTest
{
OraTest()
{
Connection connection = null;
try
{
// Load the JDBC driver
String driverName = "oracle.jdbc.driver.OracleDriver";
Class.forName(driverName);

// Create a connection to the database
String serverName = "127.0.0.1";
String portNumber = "1521";
String sid = "ram";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber +
":" + sid;
String username = "scott";
String password = "tiger";
connection = DriverManager.getConnection(url, username, password);

}
catch (ClassNotFoundException e)
{
// Could not find the database driver
}
catch (SQLException e)
{
// Could not connect to the database
}
}
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}

---------------------------------------------------------------
I am getting following error:

OraTest.java:31: cannot find symbol
symbol : variable DriverManager
location: class OraTest
connection = DriverManager.getConnection(url,
username,
password);
^
1 error

I have added classpath also. Here is my classpath:
C:\oracle\ora81\jdbc\lib\classes12.zip;D:\oracle\jdbc\lib\classes12.zip
Please guide..

Regards
Satya



Relevant Pages

  • Re: GRIDVIEW
    ... But it is difficalt to but all the connection string in the webconfig ... because the DB connection is dynamically determined by the current ... Public Function GetConnectionString(ByVal userName As String) As String ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework)
  • Re: problem when calling a stored procedure from ms sql 2000 with java
    ... > I have made my initial connection to ms sql and my database stored on it I ... > public static String username; ... > catch (SQLException sqlex) { ...
    (comp.lang.java.databases)
  • Re: access database field names in Javascript
    ... You need quotes around the string values, and you need to concatenate the ... > I trying to get information from a simple MS Access database named users ... > (username, password and stylesheet). ... > The database connection I'm using and where the SQLstr will be used is: ...
    (microsoft.public.access.formscoding)
  • PreparedStatement, ACCESS and jdbcodbc
    ... I am using the JdbcOdbc driver, ... String driverName = "sun.jdbc.odbc.JdbcOdbcDriver"; ... Connection dbConn = DriverManager.getConnection; ...
    (comp.lang.java.databases)
  • DSN-less connection with Oracle 10 drivers
    ... With Oracle 9.2 drivers, this worked connection string worked in a DSN-less ... If I switch over to use the Oracle driver for 10.2, how do I find what the ...
    (comp.databases.ms-access)