Answer Posted / rajshri
import java.sql.*;
class columncount
{
public static void main(String[]args)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection
("jdbc:odbc:mydsnname");
Statement st=con.createStatement();
String sql="select * from table_name";
ResultSet rs=st.executeQuery(sql);
ResultSetMetaData rd=rs.getMetaData();
int k=rd.getColumnCount();
System.out.println("no of count is " +k);
}
catch(SQLException e1)
{
System.out.println("not working");
}
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What does jdbc do?
Does the JDBC-ODBC Bridge support multiple concurrent open statements per connection?
Can I use JDBC to execute non-standard features that my DBMS provides?
What is @entity in java?
Which database is used for java?
Where is mysql jdbc driver located?
What is jdbc resultsetmetadata interface?
How to make updates to updatable result sets in jdbc?
Does the database server have to be running Java or have Java support in order for my remote JDBC client app to access the database?
Explain the two tier and three tier architecture of jdbc.
What is the difference between jdbc and odbc?
How do I know which jdbc driver to use?
How do I receive a ResultSet from a stored procedure?
What is jdbc url for mysql?
What do you mean by odbc?