You are not logged in. Please login at www.codechef.com to post your questions!

×

[closed] i am getting error while connecting to database (com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:

this is my code

public class DataBaseConnectivity {
public static void main(String args[])throws SQLException, ClassNotFoundException
{
    //String url="";
    //String uname="";
    //String pswd="";
    Class.forName("com.mysql.jdbc.Driver"); // loading and registering the driver
    Connection con;
    con=DriverManager.getConnection("jdbc:mysql://localhost:3306//BankAcc?autoReconnect=true&useSSL=false","root","1234");
    Statement stmt=con.createStatement();  
    ResultSet rs=stmt.executeQuery("select * from BankHolderDetails");  
    while(rs.next())  
    System.out.println(rs.getInt(1)+"  "+rs.getString(2)+"  "+rs.getString(3));  
    con.close();  
    }


}

asked 14 Feb, 03:00

sandhya06's gravatar image

0★sandhya06
1
accept rate: 0%

closed 17 Feb, 07:48

meooow's gravatar image

6★meooow ♦
7.3k720

The question has been closed for the following reason "Question is off-topic or not relevant" by meooow 17 Feb, 07:48

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×2,736
×2,655
×78

question asked: 14 Feb, 03:00

question was seen: 85 times

last updated: 17 Feb, 07:48