Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-14-2008, 10:46 AM
Member
 
Join Date: May 2008
Posts: 9
rmaadil is on a distinguished road
Getting primary key information from 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 ("jdbcdbc: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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting primary key information in Pervasive SQL rmaadil Database 0 05-14-2008 08:18 AM
JCombox DropDown is displayed on primary monitor when the box is in between two monit Kalpana.k AWT / Swing 1 05-01-2008 04:19 PM
system information nitinborge5 New To Java 1 08-07-2007 10:25 AM
how to determine the primary key osval Database 1 08-07-2007 03:31 AM
how to get information of a file leonard New To Java 2 08-01-2007 06:03 PM


All times are GMT +3. The time now is 09:55 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org