File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Driver is not supporting to retrive primary key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Driver is not supporting to retrive primary key" Watch "Driver is not supporting to retrive primary key" New topic
Author

Driver is not supporting to retrive primary key

prakash narkodu
Greenhorn

Joined: May 23, 2003
Posts: 5
i use odbc jdbc driver in my project to retrive database from sql server as well as access. I sucessfully retrived database tables but not retriving primary key. it shows error "driver not supported this funciton".So jdbc dbc driver supported these function if it is not then which driver I can use.
folling is the function that I am using in my program.

public Vector gettingPrimaryKey(String strDbUrl1,String strDbName1, String strLogin,String strPwd,String strTable)
{
String s;
String strUsr2;
Vector vecPkCol=new Vector();
if(strDataBaseType.equalsIgnoreCase("Oracle 8i"))
{
s=null;
String strUsr1=strLogin;
strUsr2= strUsr1.toUpperCase();
}
else
{
s = strDbName1;
strUsr2="dbo";
}
String t = null;
String u = null;
String[] vt = {"TABLE"};
try
{
Class.forName(strDriver);
Connection con = DriverManager.getConnection (strDbUrl1,strLogin, strPwd);
Statement stmt1=con.createStatement();
DatabaseMetaData db = con.getMetaData();
ResultSet rs = db.getTables(s,t,u,vt);
ResultSet rsPrimaryKey = db.getPrimaryKeys(s, null, strTable);
while (rsPrimaryKey.next())
{
strPkColumnName=rsPrimaryKey.getString("COLUMN_NAME");
String strPkColName=strTable+"."+strPkColumnName;
vecPkCol.add(strPkColName);
iPkColCount++;
}
rsPrimaryKey.close();
} catch(Exception se)
{
System.out.println(se);
}
return vecPkCol;
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Driver is not supporting to retrive primary key