DatabaseMetaData.getColumns() returns 0 fileds when create a synonym on?
- From: pengjetty@xxxxxxxxx
- Date: 29 Mar 2006 01:43:46 -0800
DatabaseMetaData.getColumns() returns 0 fileds when create a synonym
on?
Hi, There.
I met this problem:
1, create a user named tony (Roles: CONNECT,RESOURCE). Grant the SELECT
permis
sion on SCOTT.EMP to tony.
2, tony logon by sqlplus, "create synonym SYNO1 for SCOTT.EMP"
Then I tested the DatabaseMetaData.getColumns() using flowing code:
import java.sql.*;
import oracle.jdbc.driver.OracleDriver;
public class TestConnection {
public static void main(String[] args)
try {
String userName = "tony";
String userPassword = "tony";
String url = "jdbc:oracle:thin:@shg-d-01-tf:1521:tfang";
java.util.Properties info = new java.util.Properties();
info.put("user", userName);
info.put("password", userPassword);
info.put("includeSynonyms", "true"); // I need set it to true to ues
the synon
ym(SYNO1 ).
info.put("remarksReporting", "true");
DriverManager.registerDriver(new OracleDriver());
Connection conn =DriverManager.getConnection(url, info);
DatabaseMetaData md = conn.getMetaData();
String tableName = "EMP";
String schemaName = "SCOTT";
ResultSet rs = md.getColumns(null,schemaName,tableName,null);
int count = 0;
while (rs.next()){
count++;
System.out.println("count of " + tableName + "'s fields:" + count);
rs.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
The result:
count of EMP's fields:0
also I using scott login, it return 0 also.
When you set "includeSynonyms" to false,then the result is:
count of EMP's fields:1
Enviroment: Oracle 9.2.0.1 / Windows server 2003
And using Oracle client 9.2 connect to Oracle server 8.1.7 also has
this probl
em.
Any advice is helpful.
Thanks
.
- Follow-Ups:
- Re: DatabaseMetaData.getColumns() returns 0 fileds when create a synonym on?
- From: sybrandb@xxxxxxxxx
- Re: DatabaseMetaData.getColumns() returns 0 fileds when create a synonym on?
- Prev by Date: Re: Article about Oracle10.2 and FC5 on ORACLE-BASE is misleading
- Next by Date: Re: DatabaseMetaData.getColumns() returns 0 fileds when create a synonym on?
- Previous by thread: Mainframes Vs. Oracle
- Next by thread: Re: DatabaseMetaData.getColumns() returns 0 fileds when create a synonym on?
- Index(es):
Relevant Pages
|