-1

im trying to connect to mysql database and manipulate the data in it but when i try to run my code it get the error, driver [java application] C:\program files\java\jre 1.8.0_111\bin\javaw.exe from what ive been reading its because its launching javaw and not java.exe but i cant seem to figure out how to switch to that can anyone help me?

package jdbc;

import java.sql.*;
public class Driver {

public static void main(String[] args) {

    try
    {
        //get a connection to the database
        Connection myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/cs160test"); 
        //create a statement
        Statement myStmt = myConn.createStatement();
        //execute the sql query
        ResultSet myRs = myStmt.executeQuery("select * from genre");
        //process the result set
        while(myRs.next())
        {
            System.out.println(myRs.getString("name"));
        }
    }

    catch(Exception exc)
    {
        exc.printStackTrace();
    }

}

}

Eric Vuu
  • 47
  • 8

2 Answers2

0

That is no error. It is telling you that your program exited because there wasn't further instructions to follow.

<terminated> main [java application] path\bin\javaw.exe

I reproduced this behavior and the only way this is happening is if your genre table has no records.

Rcordoval
  • 1,932
  • 2
  • 19
  • 25
0

Ensure that all your classes are saved, including the one with the main method. If that does not work, close Eclipse and reopen it.

Farai Mugaviri
  • 105
  • 2
  • 6