Home » Open Source » Programming Interfaces » Metadata is displayed is old through JDBC even if Table is altered (Oracle 10g)
Metadata is displayed is old through JDBC even if Table is altered [message #462830] Mon, 28 June 2010 02:02 Go to next message
mamathakv
Messages: 6
Registered: June 2010
Location: bangalore
Junior Member

Hi,


Oracle 10g
Java 1.5


I have altered the table column Char(79) to Varchar2(4000)from a java program.

Iam able to view this change in both TOAD as well as SQL plus.

But when I try to view the DatabaseMetaData the java program displays the old data that is Char(79).

However, the same Java Program works fine for Oracle 9i and the DatabaseMetaData reflects the modified Varchar2(4000).

Why is this behaviour with JDBC with oracle 10g.

Thanks
Mamatha
Re: Metadata is displayed is old through JDBC even if Table is altered [message #462831 is a reply to message #462830] Mon, 28 June 2010 02:05 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
Quote:
DatabaseMetaData the java program

What do you mean by this?

regards,
Delna
Re: Metadata is displayed is old through JDBC even if Table is altered [message #462833 is a reply to message #462831] Mon, 28 June 2010 02:11 Go to previous messageGo to next message
mamathakv
Messages: 6
Registered: June 2010
Location: bangalore
Junior Member

This is my sample program that is trying to view the column type information

DatabaseMetaData meta = conn.getMetaData();
ResultSet cols = meta.getColumns(null,null, "myTable", null);

while (cols.next()) {
String col_name = cols.getString("COLUMN_NAME");
if (col_name.equals("BASE_LANGUAGE_TERM"))
{
String col_Type = cols.getString("TYPE_NAME");
}
System.out.ptintln(col_Type);
}
Re: Metadata is displayed is old through JDBC even if Table is altered [message #462836 is a reply to message #462833] Mon, 28 June 2010 02:14 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Are you sure you are connected to the right database, the right schema and query the definition of the right schema object?

Regards
Michel
Re: Metadata is displayed is old through JDBC even if Table is altered [message #462839 is a reply to message #462836] Mon, 28 June 2010 02:19 Go to previous messageGo to next message
mamathakv
Messages: 6
Registered: June 2010
Location: bangalore
Junior Member
Yeah, cross verified.

This behaviour is strange Sad .

More over application is from different machine & database in another machine.

one Application has modified(altered the table) and closed.
And we are trying to view the changes through application instance in differnt client machine.

I would re-iterate the same process is in fine with oracle 9i.

Is there a need to re-start the Oracle 10g Database.
Re: Metadata is displayed is old through JDBC even if Table is altered [message #462863 is a reply to message #462839] Mon, 28 June 2010 04:53 Go to previous messageGo to next message
mamathakv
Messages: 6
Registered: June 2010
Location: bangalore
Junior Member

I found the issue.

In oracle 10g, meta.getcolumns was returning the columns from all the schema's present in the database.

So specifying the schemaname(case_sensitive) as follows solved my issue.

ResultSet cols = meta.getColumns(null,"schema_name", "myTable", null);


Thanks all
Re: Metadata is displayed is old through JDBC even if Table is altered [message #462866 is a reply to message #462863] Mon, 28 June 2010 05:07 Go to previous message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Thanks for the feedback.

Regards
Michel
Previous Topic: ORA-28150 when I use proxy user by JDBC , but sqlplus not
Next Topic: Does ODBC connection from INFORMIX DB to MS ACCESS has committed read on the data?
Goto Forum:
  


Current Time: Sat Dec 21 21:18:47 CST 2024