JDBC:ODBC: getTabel-Method in not working? 
Author Message
 JDBC:ODBC: getTabel-Method in not working?

Hello,

as an exercise for learning Java and as a part of an other project,
i have to convert a MS-Access 7.0 Database into mSQL-Database.
Because the Access-Database contains a lot of tables with a lot
of columns each, I want to automate the process using the
getTable-Method of the JDBC-ODBC-Package of Sun. But
all I receive is the following SQLExeption-Message at runtime:

[Microsoft][ODBC Microsoft Access 97 Driver]Driver not capable
java.sql.SQLException: [Microsoft][ODBC Microsoft Access 97 Driver]Driver
not
capable

I cannot imagine, that MS did not implement that Funktion in their
ODBC-Driver Ver 3.0, especialy because it is mentioned in their
ODBC-helpfile.

??? WHATS WRONG ???

Here the source:
----------------------------------------------------------------------------
---
import java.net.URL;
import java.sql.*;

class TabNames {
  public static void main(String argv[]) {

    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    }
    catch (Exception e) {
      e.printStackTrace();
    }

    try {
      String url = "jdbc:odbc:WWS_ODBC"; String user = ""; String pwd = "";

      Connection con = DriverManager.getConnection(url, user, pwd);     //this
works fine
      DatabaseMetaData dmd = con.getMetaData();                         //this works fine too

      // This line and some variants of it throw SQLExceptions like
"Database not capable"
      ResultSet rs = dmd.getTables("CATALOG", "", "", "");

      con.close();
    }
    catch( Exception e ) {
      System.out.println(e.getMessage());
      e.printStackTrace();
    }
  }

Quote:
}

----------------------------------------------------------------------------
---


Tue, 19 Oct 1999 03:00:00 GMT
 JDBC:ODBC: getTabel-Method in not working?


"      // This line and some variants of it throw SQLExceptions like
""Database not capable"
"      ResultSet rs = dmd.getTables("CATALOG", "", "", "");

The method is not:
   DatabaseMetaData.getTables (String, String, String, String)

It is:
   DatabaseMetaData.getTables (String, String, String, String[])

so your last parameter should be null and not the-empty-string.

It helps to read the API.

Jason
--
Join the FreeBSD Revolution!

http://xcf.berkeley.edu/~nordwick



Thu, 21 Oct 1999 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. JDBC-ODBC: Use of getHDBC() method of sun.jdbc.odbc.JdbcOdbcConnection

2. ODBC to JDBC bridge? (not JDBC to ODBC)

3. ODBC to JDBC bridge? (not JDBC to ODBC)

4. JDBC-ODBC driver is not working in I.Explore

5. JDBC-ODBC does not work for long datatypes using prepared statements

6. Client drivers conflict: JDBC does not work with ODBC

7. JDBC : ODBC Connection Works on one machine but not the other

8. ODBC-JDBC: Calling ODBC methods

9. JDBC not working with tomcat 4 / works on command line

10. JDBC Driver for MS Access (Not JDBC-ODBC Driver)

11. .addnew method ADO does not work pls help


 
Powered by phpBB® Forum Software