Extracting METADATA from JDBC connection

Paul Hopkins phopkins at hi-q.co.uk
Tue Jul 17 08:34:37 EDT 2001


Hello,
      I am evaluating freeTDS and am tring to check whether it supports db metadata. I am using the following code but getting the SQLException with the message 'Confused'. Any help is appreciated.

Thanks, Paul

            Class.forName("com.internetcds.jdbc.tds.Driver");
            String url = "jdbc:freetds:sqlserver://"+serverName+":1433/"+database;//+";TDS=7.0";
            // Create the usename and password properties
            try
            {
                // Create the connection
                Connection c = DriverManager.getConnection( url, username, password );
                // Run a simple query
                Statement s = c.createStatement();
                ResultSet rs = s.executeQuery("select * from phSourcePerson");
                while (rs.next())
                {
                 System.out.println(rs.getString(1) + " : " + rs.getInt(2));   
                }
                rs.close();
                s.close();
                System.out.println("Retrieving a list of all tables");
		DatabaseMetaData md = c.getMetaData();
                // THIS IS THE CALL THAT FAILS 
		rs = md.getTables( null, null, "phSourcePerson", new String[]{"TABLE"});
		System.out.println("After");
		while (rs.next())
		{
                 System.out.println(rs.getString(1));   
                }
                rs.close();
                c.close();
 



More information about the FreeTDS mailing list