i already have xammp set up on localhost. and
i also added a "mysql-connector-java-5.1.22-bin" file to m exlipse under "JRE SYSTEM LIBRARY"
information on xammp:
user name: "root"
password: ""
database: "a_upload"
table: "user"
in eclipse iam just testing my connection. but i get a error:
SQLException: Unknown database '/a_upload' SQLException: 1049
how i now what the error mean but i dont now why it give me the error.
import java.sql.*; public class database01 { public static void main(String[]args) { Connection connect = null; try{ Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager.getConnection("jdbc:mydql://localhost//a_upload","root",""); Statement sqlState = connect.createStatement(); String selectStuff = "Select firstname from user"; ResultSet rows = sqlState.executeQuery(selectStuff); while(rows.next()) { System.out.println(rows.getString("firstname")); } } catch(SQLException e){ System.out.println("SQLException: "+e.getMessage()); System.out.println("SQLException: "+e.getErrorCode()); } catch(ClassNotFoundException e){ e.printStackTrace(); } } }