This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Problem in retieving user defined datatypes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem in retieving user defined datatypes" Watch "Problem in retieving user defined datatypes" New topic
Author

Problem in retieving user defined datatypes

Ram Mohan
Greenhorn

Joined: Oct 21, 2005
Posts: 26
Hi Friends,

Its me again with some problems.

I am accessing the database and populate in a JTable with the help of a tablemodel. I am retrievig the data by


And now using this I am not getting user defined datatypes.
For example: When I access "select * from sysdatabases" the column name will have no values.( name is sysname datatype).

any one have any suggestions.

Ram Mohan.
Ram Mohan
Greenhorn

Joined: Oct 21, 2005
Posts: 26
I know we can cast like following

"
select cast(name as varchar) from Master..sysdatabases

"

and it works ,but I am getting the query from the user in a textarea.

So I cannot dynamically do it.

An alternative I found is
......

Statement stmt = connection.createStatement();
ResultSet rs= stmt.executeQuery("SELECT * FROM emp_table");
if(rs.next()) {
java.sql.Struct empType = (java.sql.Struct)rs.getObject(1);
System.out.println("Number of attributes "+ empType.getAttributes().length);
System.out.println("Name is " + empType.getAttributes()[0]);
System.out.println("Designation is " + empType.getAttributes()[1]);
System.out.println("Department is " + empType.getAttributes()[2]);
}
stmt.close();


......

But it cannot be implemented in TableModel, So pls someone help me.

Ram Mohan
 
Don't get me started about those stupid light bulbs.
 
subject: Problem in retieving user defined datatypes
 
Similar Threads
contents of Map Object in setTypeMap?
JAX-RPC DII or Stub based client
DB app: complex text structure
j2ee and .net
xml schema with xerces parser