Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class Main {

    public static void main(String[] args) throws Exception {
        Connection conn = null;
        conn = DriverManager.getConnection("jdbc:mysql://192.168.1.3/greektest?"
                + "useUnicode=yes&characterEncoding=UTF-8" + "&user=root&password=obfuscated");
        String sql = "INSERT INTO `chars` (`value`) VALUES (?)";
        PreparedStatement pst = conn.prepareStatement(sql);
        String var1 = "asdf";
        pst.setString(1, var1);
        pst.executeUpdate();
    }

}