problem in using DatabaseMetaData getColumns()

Поиск
Список
Период
Сортировка
От arun vc
Тема problem in using DatabaseMetaData getColumns()
Дата
Msg-id 20020902144902.52552.qmail@web11504.mail.yahoo.com
обсуждение исходный текст
Ответы Re: problem in using DatabaseMetaData getColumns()
Список pgsql-jdbc
hello

i am getting error while using uisng
dmd.getColumns(null,null,MY_TABLE_NAME,null);
i am gtting error while using the new pgjdbc2.jar
driver with the old driver postgresql.jar this method
is working .can you help me in solving this problem.
i am sending a sample code


import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.sql.ResultSet;

class CheckDB
{
public static void main(String args[])throws
Exception{

String MY_TABLE_NAME="computers";
Connection con;

    try
    {

        Class.forName("org.postgresql.Driver");
        con =
DriverManager.getConnection(jdbc:postgresql://localhost/mytab,loginname,password);

        DatabaseMetaData dmd = con.getMetaData();
        String[] tableType = {"TABLE"};

        ResultSet rs = dmd.getTables(null, null, null,
tableType);

        while ( rs.next() )
        {
            if(MY_TABLE_NAME.equals(rs.getString( "TABLE_NAME"
)))
                System.out.println(MY_TABLE_NAME +" found in
database " ) ;
        }
        rs.close();

        rs = dmd.getColumns(null,null,MY_TABLE_NAME,null);
        // when i try to use
getColumns(null,null,MY_TABLE_NAME,null); method
        // i am getting exception :ERROR:  parser: parse
error at or near "("
        // i am gtting this error while using the new
pgjdbc2.jar Driver
        // with the old driver postgresql.jar this method is
working

        while(rs.next())
        {
         colNames[totalFields]=rs.getString( "COLUMN_NAME"
);//here COLUMN_NAME is a key word
         System.out.println("COLUMN_NAME : " +
colNames[totalFields]);
        }
        rs.close();

    }
    catch(SQLException e)
    {
        System.out.println("here i am :"+e.getMessage());

    }
   }
}


=====

would you like to help someone see the beauty of the world through your eyes long after you have gone
http://www.ebai.org

Arun VC, E Team India Web Solutions,
Serene,Anupama Nagar,Pongummoodu,Trivandrum
Phone Off: +91 471 558089. Res : +91 471 343954.
http://www.e-zenit.it
http://www.geocities.com/vcarun


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Harrison
Дата:
Сообщение: Re: 7.0 - 7.2 upgrade, org.postgresql.Driver Class not found
Следующее
От: Harrison
Дата:
Сообщение: Re: 7.0 - 7.2 upgrade, org.postgresql.Driver Class not found