how can we get the metaData (columnNames) from a table which
has no Records..

Answers were Sorted based on User's Feedback



how can we get the metaData (columnNames) from a table which has no Records....

Answer / sreenivas

Hi,
You can use DatabasrMetaData class to get the databse
information like... schenmaname, tables, columnnames,
etc....

DatabaseMetaData metaData = new DBConnection().getMetaData
();

Is This Answer Correct ?    2 Yes 1 No

how can we get the metaData (columnNames) from a table which has no Records....

Answer / srinivas

we get it from ResultSetMetaData

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More JDBC Interview Questions

dear friends I have made connection with SQLSERVER where the following code is compiling properly but giving error at the runtime . I think error in this line where i am sending the value through string Connection connection = DriverManager.getConnection ( "jdbc:microsoft:sqlserver://localhost:1433","sa",""); import java.sql.*; //import mssqlserver.*; public class TestSQLCON { public TestSQLCON() throws Exception { // Get connection DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver()); System.out.println(); System.out.println("Successfully connected one"); System.out.println(); Connection connection = DriverManager.getConnection ( "jdbc:microsoft:sqlserver://localhost:1433","sa",""); if (connection != null) { System.out.println(); System.out.println("Successfully connected"); System.out.println(); // Meta data DatabaseMetaData meta = connection.getMetaData(); System.out.println("\nDriver Information"); System.out.println("Driver Name: " + meta.getDriverName()); System.out.println("Driver Version: " + meta.getDriverVersion()); System.out.println("\nDatabase Information "); System.out.println("Database Name: " + meta.getDatabaseProductName()); System.out.println("Database Version: "+ meta.getDatabaseProductVersion()); } } public static void main (String args[]) throws Exception { TestSQLCON test = new TestSQLCON(); } } so please help me

2 Answers  


What is the difference between executing, executequery, executeupdate in jdbc?

0 Answers  


What is the jdbc rowset?

0 Answers  


Hi........I need to create a dropdown box using java.....this box should show the values that should be taken from the database...... Thank you....

1 Answers  


Which of the attributes in the monitoring tab for a jdbc connection pool in the administrative console tell us how many clients are currently waiting for a connection?

0 Answers  






What is the execute method in java?

0 Answers  


Why “no suitable driver” error occurs?

0 Answers  


What are the differences between resultset and rowset?

0 Answers  


How to use JDBC API to call Stored Procedures?

0 Answers  


What is JDBC Statement?

0 Answers  


What is a jdbc url?

0 Answers  


What is sqlwarning and discuss the procedure of retrieving warnings?

0 Answers  


Categories