Question: I'm creating my first Java program that pulls data from a **MySql database**. I'm having trouble getting the result from a query to print in console. My program compiles without error but **out.print command not displaying content in console**. I'm using Intellij IDEA 15.0.2.

```
import java.sql.*;
import static java.lang.System.*;

public class Main {
public static void main(String[] args) {
String url = "jdbc:mysql://localhost:3306/animal";
    String user = "username";
    String pwd = "password";
    try {
        Connection connection =
             DriverManager.getConnection(url, user, pwd); // Get Connection
     Statement statement = connection.createStatement(); // Create Statement
        String query = "SELECT * FROM animal";
      ResultSet resultSet = statement.executeQuery(query); // Execute Query
        while (resultSet.next()) { // Process Results
            out.print(resultSet.getInt("animal_id"));

        }
    } catch (SQLException se) { }
}
}

```

Answer: 
Yeah.. as BradStell said you have to use 

```
      System.out.print(resultSet.getInt("animal_id"));
```

instead of

```
      out.print(resultSet.getInt("animal_id"));
```

Another suggestion that I would like to make is Always do something on catching an exception. You have no code in the catch block. Atleast try to print the exception there. That would help you very much in finding errors in your code .
The problem was with the database driver. I needed to use the **forName method()**, and add the driver url for MySql. After I successfully implemented this class I was able to create sql queries without issue. Thanks for the tip with the exception handling @Senthil Vidhiyakar

```
try {
        Class.forName("com.mysql.jdbc.Driver");
        System.out.print("Working");
    }
    catch (Exception e){ System.out.println("Not working");} 

```

I also had to connect the mysql connector jar. The process for doing this in Intellij IDEA is as follows.

**File >> Project Structure** "The project structure window will appear then on the **left side menu *click Modules*** in the main content area **click on the Dependencies tab**. Next **click the green +**. *Choose option 1 JARs or directories*. Finally, navigate to the mysql connector jar. Then **click apply, and ok**."