Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JDBC and Relational Databases
reading default value of a column
yogi butola
Greenhorn
Posts: 5
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all
This is urgent.
In my application I want to read the default value of a column.
Pls help
Shailesh Chandra
Ranch Hand
Posts: 1087
I like...
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This method will return you default value of column.
public String getColumnDefaultValue(Connection conn,String TableName,String ColumnName) throws Exception { String columnDefaultVal = ""; DatabaseMetaData md = conn.getMetaData() ; ResultSet rs = md.getColumns(conn.getCatalog(), md.getUserName(),TableName,ColumnName); if(rs.next()) { columnDefaultVal = rs.getString("COLUMN_DEF"); } System.out.println("Default Value of Column is " + columnDefaultVal ); return columnDefaultVal; }
Shailesh
Gravitation cannot be held responsible for people falling in love ~
Albert Einstein
look! it's a bird! it's a plane! It's .... a teeny tiny ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Default value of a column using EJB3 entity beans
how to insert a current date into the database table ?
Insert a timestamp into mysql database
default value for c:out tag in table
inserting a row when there is a sequence in that table
More...