Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2002
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    null pointer exception

    <%
    // load driver
    Class.forName("org.gjt.mm.mysql.Driver");

    // pass database parameters to JDBC driver
    Connection Con = DriverManager.getConnection("jdbc:mysql://localhost/MovieXpress?user=root&password=root");

    // query statement
    Statement SQLStatement5 = Con.createStatement();

    Statement SQLStatement6 = Con.createStatement();
    %>

    <%
    // select movietitles from cathay
    ResultSet rs5 = SQLStatement5.executeQuery("SELECT DISTINCT MovieTitle FROM cathay");

    // insert all the movietitles from cathay into a table
    while(rs5.next()) {

    String cathay_movie = rs5.getString("MovieTitle");

    ResultSet rs6 = SQLStatement6.executeQuery("INSERT INTO combine (MovieTitle) VALUES ('"+cathay_movie+"')");

    }
    %>

    hi, wat's the problem wif this code?

    the error message that i got is: java.lang.NullPointerException

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Why do you have two different forum logins?

    http://codingforums.com/showthread.php?s=&threadid=8811
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    New Coder
    Join Date
    Sep 2002
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ohh.... juz using my friends' account.... i myself juz registered today....

    i was at his house, so its auto-logined with his username...so i used his account to post...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •