Note that there are some explanatory texts on larger screens.

plurals
  1. POInsert table values from a SQL database to an ArrayList
    text
    copied!<p>I'm trying to insert some values from my database into an ArrayList. I guess there is some problem with the method showMeeting(). Hopefully you guys can understand some of the message get from the console.</p> <pre><code>public ArrayList&lt;String&gt; showMeeting() { ArrayList&lt;String&gt; output = new ArrayList&lt;String&gt;(); try { Class.forName(driverName).newInstance(); con = DriverManager.getConnection(url + dbName, userName, password); try { Statement st = con.createStatement(); String meetID = "SELECT meetID FROM Meeting"; ResultSet rs = st.executeQuery(meetID); while(rs.next()){ output.add(rs.toString()); } } catch (SQLException s) { System.out.println("Wrong sql-query"); } con.close(); } catch (Exception e) { e.printStackTrace(); } return output; } public static void main(String[] args) { InteractWithDatabase2 test = new InteractWithDatabase2(); ArrayList&lt;String&gt; meetID = test.showMeeting(); String meetings = ""; for (int i = 0; i &lt;meetID.size(); i++) { meetings += meetID.get(i) + "\n"; } System.out.println(meetings); } </code></pre> <p>When I'm trying to run this in Eclipse, i get this message:</p> <blockquote> <p>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at no.ntnu.fp.model.InteractWithDatabase2.visMoter(InteractWithDatabase2.java:107) at no.ntnu.fp.model.InteractWithDatabase2.main(InteractWithDatabase2.java:127)</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload