Results 1 to 1 of 1
- 05-14-2008, 07:18 AM #1
Member
- Join Date
- May 2008
- Posts
- 9
- Rep Power
- 0
Getting primary key information in Pervasive SQL
I am doing a project in which I have to get the primary key information of a Table at run time. I have to do this task in both SQL Server and Pervasive SQL Databases. I found a function getPrimaryKeys() to do this task. The problem is that this function is giving results in the SQL Server Database but its not giving any result in the Pervasive SQL Database. I have debuged the following code and in case of Pervasive the getPrimaryKeys() method is returning empty ResultSet.
import java.sql.*;
public class Main {
public static void main(String[] args) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newI nstance();
Connection db_connection =
DriverManager.getConnection ("jdbc:odbc:MQAUPDT", "", "");
Statement db_statement = db_connection.createStatement();
String tableName = "GPRCCODE";
ResultSet rs = null;
DatabaseMetaData meta = db_connection.getMetaData();
rs = meta.getPrimaryKeys(null, null, tableName);
while (rs.next())
{
System.out.println(rs.getString("COLUMN_NAME"));
}
rs.close();
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
Can anyone tell me that whether this method works for Pervasive or not? And if this method doesn't work with Pervasive then whats the alternate way of doing the same thing.
Waiting for the reply and thanks in advance.
Similar Threads
-
JCombox DropDown is displayed on primary monitor when the box is in between two monit
By Kalpana.k in forum AWT / SwingReplies: 1Last Post: 05-01-2008, 03:19 PM -
system information
By nitinborge5 in forum New To JavaReplies: 1Last Post: 08-07-2007, 09:25 AM -
how to determine the primary key
By osval in forum JDBCReplies: 1Last Post: 08-07-2007, 02:31 AM -
Information about Struts
By Felissa in forum Web FrameworksReplies: 2Last Post: 07-02-2007, 04:40 PM -
Some information about Hibernate
By Marcus in forum JDBCReplies: 2Last Post: 07-02-2007, 04:26 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks