Jump to content

Java MySQL clarification


PC-2011
 Share

Recommended Posts

ok so im creating a program that will run thro a set of a questions and send the results to my sql server.

if have

import java.sql.Connection;  
import java.sql.DriverManager;
import java.sql.ResultSet;  
import java.sql.Statement;  
  
public class MySQL {
    public MySQL()
    {
        Connect();
    }

    public static void Connect(){ 
      
        try {  
            Class.forName("com.mysql.jdbc.Driver");  
            Connection connection = DriverManager.getConnection(  
                    "jdbc:mysql://localhost:3306/test", "user1", "test");  
            Statement statement = connection.createStatement();  
            ResultSet resultSet = statement  
                    .executeQuery("");  
            while (resultSet.next()) {  
                System.out.println(""));  
            }  
        } catch (Exception e) {  
            e.printStackTrace();  
        }  
    }  
}  

so i know im going to need to learn some sql but where would i put the command to send the array of answers with a user id and score. the array is a list of stings the id is a int and the score is a int if that helps

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...