 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
lmclaus Guest
|
Posted: Wed Nov 26, 2003 6:17 pm Post subject: Problem with JDBC-ODBC connection to MS Access 2000 |
|
|
I am trying to use JDBC-ODBC bridge to connect to a Access 2000
database on a Windows 2000 machine. I have set up
the database using the Data Sources utility in Windows 2000. I am
using the Java(TM) 2 SDK, Standard Edition
Version 1.4.2_01. The code snippet from an example I found is:
import java.sql.*;
import javax.swing.JOptionPane;
public class BookDB{
private static Connection connection;
private static Statement scrollStatement;
private static ResultSet books;
public static void connect() throws ClassNotFoundException,
SQLException {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:MurachBooks";
String user = "Admin";
String password = "";
connection = DriverManager.getConnection(url, user, password);
}
When I complie I get the following error:
BookDB.java [10:1] cannot resolve symbol
symbol : method forName (java.lang.String)
location: class Class
try {Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
^
1 error
Errors compiling BookDB.
I have looked at all of the possible sources of information I can
think of to find an answer to my problem.
|
|
| Back to top |
|
 |
Stefan Siegl Guest
|
Posted: Thu Nov 27, 2003 9:10 pm Post subject: Re: Problem with JDBC-ODBC connection to MS Access 2000 |
|
|
I do not see any errors in the code. The same code will work fine for me
(there is no compile time error). Are you sure that you did not mess up
with the standard classpath?
lmclaus wrote:
| Quote: | I am trying to use JDBC-ODBC bridge to connect to a Access 2000
database on a Windows 2000 machine. I have set up
the database using the Data Sources utility in Windows 2000. I am
using the Java(TM) 2 SDK, Standard Edition
Version 1.4.2_01. The code snippet from an example I found is:
import java.sql.*;
import javax.swing.JOptionPane;
public class BookDB{
private static Connection connection;
private static Statement scrollStatement;
private static ResultSet books;
public static void connect() throws ClassNotFoundException,
SQLException {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:MurachBooks";
String user = "Admin";
String password = "";
connection = DriverManager.getConnection(url, user, password);
}
When I complie I get the following error:
BookDB.java [10:1] cannot resolve symbol
symbol : method forName (java.lang.String)
location: class Class
try {Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
^
1 error
Errors compiling BookDB.
I have looked at all of the possible sources of information I can
think of to find an answer to my problem.
|
|
|
| Back to top |
|
 |
lmclaus Guest
|
Posted: Fri Nov 28, 2003 1:52 pm Post subject: Re: Problem with JDBC-ODBC connection to MS Access 2000 |
|
|
Stefan Siegl <Stefan.Siegl (AT) gmx (DOT) de> wrote
| Quote: | I do not see any errors in the code. The same code will work fine for me
(there is no compile time error). Are you sure that you did not mess up
with the standard classpath?
lmclaus wrote:
I am trying to use JDBC-ODBC bridge to connect to a Access 2000
database on a Windows 2000 machine. I have set up
the database using the Data Sources utility in Windows 2000. I am
using the Java(TM) 2 SDK, Standard Edition
Version 1.4.2_01. The code snippet from an example I found is:
import java.sql.*;
import javax.swing.JOptionPane;
public class BookDB{
private static Connection connection;
private static Statement scrollStatement;
private static ResultSet books;
public static void connect() throws ClassNotFoundException,
SQLException {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:MurachBooks";
String user = "Admin";
String password = "";
connection = DriverManager.getConnection(url, user, password);
}
When I complie I get the following error:
BookDB.java [10:1] cannot resolve symbol
symbol : method forName (java.lang.String)
location: class Class
try {Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
^
1 error
Errors compiling BookDB.
I have looked at all of the possible sources of information I can
think of to find an answer to my problem.
|
The classpath variable setting certainly may be a problem. I have been
confused by the instructions I have read on what I need to define for
various path settings and whether they need to be in a User or System
path variable.
|
|
| Back to top |
|
 |
Bjorn Abelli Guest
|
Posted: Fri Nov 28, 2003 3:03 pm Post subject: Re: Problem with JDBC-ODBC connection to MS Access 2000 |
|
|
"lmclaus" wrote...
| Quote: | I am trying to use JDBC-ODBC bridge to connect to a Access 2000
database on a Windows 2000 machine. I have set up
the database using the Data Sources utility in Windows 2000. I am
using the Java(TM) 2 SDK, Standard Edition
Version 1.4.2_01. The code snippet from an example I found is:
The classpath variable setting certainly may be a problem. I have been
confused by the instructions I have read on what I need to define for
various path settings and whether they need to be in a User or System
path variable.
|
With that configuration you shouldn't need to have the classpath as an
environment variable at all.
// Bjorn A
|
|
| Back to top |
|
 |
Stefan Siegl Guest
|
Posted: Sat Nov 29, 2003 1:45 am Post subject: Re: Problem with JDBC-ODBC connection to MS Access 2000 |
|
|
lmclaus wrote:
| Quote: | Stefan Siegl <Stefan.Siegl (AT) gmx (DOT) de> wrote
I do not see any errors in the code. The same code will work fine for me
(there is no compile time error). Are you sure that you did not mess up
with the standard classpath?
lmclaus wrote:
I am trying to use JDBC-ODBC bridge to connect to a Access 2000
database on a Windows 2000 machine. I have set up
the database using the Data Sources utility in Windows 2000. I am
using the Java(TM) 2 SDK, Standard Edition
Version 1.4.2_01. The code snippet from an example I found is:
import java.sql.*;
import javax.swing.JOptionPane;
public class BookDB{
private static Connection connection;
private static Statement scrollStatement;
private static ResultSet books;
public static void connect() throws ClassNotFoundException,
SQLException {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:MurachBooks";
String user = "Admin";
String password = "";
connection = DriverManager.getConnection(url, user, password);
}
When I complie I get the following error:
BookDB.java [10:1] cannot resolve symbol
symbol : method forName (java.lang.String)
location: class Class
try {Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
^
1 error
Errors compiling BookDB.
I have looked at all of the possible sources of information I can
think of to find an answer to my problem.
The classpath variable setting certainly may be a problem. I have been
confused by the instructions I have read on what I need to define for
various path settings and whether they need to be in a User or System
path variable.
|
If you do not change the bootstrap ClassLoader of Java then all the
needed classes should be loaded automatically be the JVM. If you are not
completely sure if you change it, perhaps you can provide the command
you use to start your program.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|