Share on Google+Share on Google+

jdbc mysql
2 Answer(s)      8 years ago
Posted in : JDBC


View Answers

September 12, 2008 at 11:29 AM

Might be problem in your mySql, the above code is working fine.
first you check for connection u geeting or not.


September 12, 2008 at 4:00 PM


I am sending you code for displaying all table name from database.

package javacode;

import java.sql.*;

public class DisplayTablename{

public static void main(String[] args) {
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://";;
String dbName = "amar";
String userName = "amar";
String password = "amar123";
System.out.println("Listing all table name in Database!");
Connection con=DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connect to database!");
DatabaseMetaData dbm = con.getMetaData();
String[] types = {"TABLE"};
ResultSet rs = dbm.getTables(null,null,"%",types);
System.out.println("Table name:");
while ({
String table = rs.getString("TABLE_NAME");
catch (SQLException s){
System.out.println("No any table in the database");
catch (Exception e){


Visit for more information.



Related Tutorials/Questions & Answers:
MySQL Driver for JDBC - JDBC
MySQL Driver for JDBC  Sir, I have started reading your JDBC tutorial for MySQL. I have installed MySQL successfully. But I do not have MySQL... Example."); Connection conn = null; String url = "jdbc:mysql://localhost:3306  
jdbc mysql - JDBC
=DriverManager.getConnection("jdbc:mysql://localhost:3306/ram","root","root...jdbc mysql  import java.sql.*; public class AllTableName... be problem in your mySql, the above code is working fine. first you check
mysql jdbc connectivity
mysql jdbc connectivity  i want to connect retrieve data from mysql using jdbc
Prepared statement JDBC MYSQL
Prepared statement JDBC MYSQL  How to create a prepared statement in JDBC using MYSQL? Actually, I am looking for an example of prepared statement.   Selecting records using prepared statement in JDBC
how to connect mysql with JDBC - JDBC
in the database MYsql, i have to connect them now using JDBC, can u please suggest me... { connection = DriverManager.getConnection("jdbc:mysql://localhost...(); } } Thanks Rajanikant  Hi friend, To mysql connect using JDBC
jdbc connectivity to mysql tutorial
jdbc connectivity to mysql tutorial  here is complete jdbc connectivity to mysql tutorial for newbies. Person who don't even know how to install mysql and don't know about which driver to use can do with ease
Mysql & java - JDBC
; String url = "jdbc:mysql://localhost:3306/"; String dbName... on JDBC visit to : & java  Hi guys, please help! I'm new to mysql, I want
maven mysql jdbc driver
maven mysql jdbc driver  How to add the maven mysql jdbc driver dependency in the pom.xml file of a maven based application?   Hi, Its...;groupId>mysql</groupId> <artifactId>mysql-connector-java<
mysql problem - JDBC
= "jdbc:mysql://localhost:3306/test"; Connection con=null; try...mysql problem  hai friends please tell me how to store the videos in mysql plese help me as soon as possible thanks in advance   
mysql tables - JDBC
"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/databasename...mysql tables  hi, I have a table in MySql, having fields, emp_id,emp_name,emp_vertical,emp_supervisor. i need a JDBC program with driver
install mysql - JDBC
install mysql  i want to connect with mysql database.can i install mysql on local system please send me link how download mysql   Hi friend, MySQL is open source database and you can download and install it on your
mysql datasource - JDBC
mysql datasource  hello there......... i'm a real beginner for mySql can any one tell me how i do configurations in my windows machine after installing mysql(version 5.1).. i've added the Connector/J to the calss path
MySql ClassNotFoundException - JDBC
MySql ClassNotFoundException  Dear sir, i am working in Linux platform with MySQL database , actually i finished all installation in MySQL... install in linux any software making connection between java and MySQL. Or how can i
JAVA & MYSQL  How can we take backup of MySQL 5.0 database by using...;Hi Friend, Please visit the following page for working example of MySQL backup. This may help you in solving your problem.
mysql andservlets - JDBC
mysql andservlets  I have two tables with primarykey fields.I need to retrive records from two tables using their primary key.What is the query in mysql?and what is the code in servlets?  Hi friend, For solving
mysql installation problem - JDBC
mysql installation problem  Hi, when i installing mysql server on my pc in MySQL Server Instance Configuration Wizard,I enter the root pw... information.
MySQL connectivity - JDBC
MySQL connectivity  hi all, i am not able to connect Mysql to java i connect it ..i am getting the error ..saying classNotFoundException... to "com.mysql.jdbc.Driver" class not found In the lib folder "mysql-connector-java-5.0.6-bin.jar
not able to connect to mysql using.. jdbc
not able to connect to mysql using.. jdbc   i am not able to connect to mysql using jdbc .. is there any classpath that i need to set..because i am using mysql-connector-java jar connect to mysql.. Pls provide the steps
MYSQL and SERVLETS  I did addition ,deletion of data in mysql using servlets .I do not know that how to combine these two programs into a single program .When I click this add menu it has to be added the data in table .when i
mysql problem - JDBC
mysql problem   hai friends i have some problem with image storing in mysql. i.e while i am using image(blob) for insert the image it says... of creation of table in mysql. it will take any image and store in database
jdbc driver for mysql - Java Beginners
of jdbc-mysql database connectivity and idea about jdbc and mysql driver...jdbc driver for mysql  I need jdbc driver program for connecting java progrma to mysql. Please any one send me the url to download the driver
using pb datawindow activex with jdbc for mysql - JDBC
using pb datawindow activex with jdbc for mysql  Hi, I am trying to use datawindow activex in a web page. I need to connect to mysql database located on the server. I have downloaded the connectj for mysql. What should
Connecting to remote mysql server using jdbc.
Connecting to remote mysql server using jdbc.  How to Connect to remote mysql server using jdbc
MySQL restore function in java - JDBC
MySQL restore function in java  I would like to import to a database .sql file. It is possible with the use of mysql administrator, however I would like to do the same with the use of java.Is it possible?If yes, how to do
MySQL JDBC Driver pom dependency code
MySQL JDBC Driver pom dependency code  Hi, What is the POM dependency code for MySQL's latest JDBC Driver? I can download the MySQL driver from mysql website but I need to use it in a application which is based on Maven 3
jdbc,odbc,MySQL,swing - Java Beginners
jdbc,odbc,MySQL,swing  write a code that displays a menu list of all available database drivers in a window,and allows the user to select any driver... to the selected database driver.It is very well known as jdbc front end of a database
spring mvc configuration with mysql using jdbc
spring mvc configuration with mysql using jdbc  hai I want to configure web mvc with mysql using jdbc template. when I submit values using registration form it will reflect on database which i was created earlier. send me code
Video Tutorial: How to access MySQL through JDBC?
How to access MySQL through JDBC? The interface that is used to access... of "How to Access MySQL through JDBC?": In the JAR selection window... run as option. If successful, you can now access Mysql through JDBC. You
can't connect to MySQL Server(10060) - JDBC
can't connect to MySQL Server(10060)  Hii Sir, I am working with a jsp project with MySQL as server. Now i want to host my application. I am created a DB in the Hosting MySQL server and now i want to create a table By using
JDBC Drive For Mysql
JDBC Drive For Mysql      ...; jdbc driver for mysql is specified in string driver.  JdbcDriveForMysql... jdbc driver for mysql : com.mysql.jdbc.Driver Download code
Video Tutorial: How to download JDBC from MySQL?
How to download JDBC from MySQL? The video here teaches on how to download JDBC driver for mysql. The following steps shall guide you to a successful... For an assurance, Open the file and check for mysql-connector-java-5.1.35-bin.jar
Java Spring Hibernate Struts Training how to retrieve text and images from mysql database and show on html page using jsp servlet How to install Neo4j on Ubuntu 15.10? please help me in these prog MYSQL - mysql copy table to another table example by creating new table solution for mapping hibernate and pojos from net beans through database Connect GWT application with Oracle inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store This code have created jTable that connected with a database.every cell of last column have a button.But this button doesn't work properly.Where is the error java program Java Database Program jdbc Database connection class in a live project ..?? What is JDBC architecture? Unable to Create DSN for excel to ms access importing data and edit that data Database Scrolling Buttons how to use foreign key in java How to delete content of a log file from linux terminal? JSP-Oracle connectivity Student Management System Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same crud operations with foreign key constraint. I really need help with this assignment question Please help me out Please Backup Failed Mysqldump Got Errno 28 On Write Upgrade MySQL 5.1 to 5.5 in cpanel mysqldump all databases com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist persistence xml class element persistence.xml for MySQL MySQL JDBC Driver pom dependency code Blob column jdk6 and oracle 8i connexion oracle 8i et jdk6 java [ cannot retrive date from sql ] why?? Order Entry System How to threow timeout exception when DB is not responding How to threow timeout exception when DB is not responding This is the employee form to add data to mysql database but I got error of NullPointerException, Is this write code please give me feedback as soon as possible make a method which takes user name & pwd as parameter & validate them against the database. If the corresponding user exist return true otherwise false. prabhakar validating credentials and displaying error message in login .jsp if not valid JDBC jdbc jdbc code register servlet vibhu connectiondetails from vibhu


Advertisement null