Akses SQLite menggunakan JDBC (java)

import java.sql.*;

public class Main {
   public static void main(String[] args) throws Exception {
         Class.forName("org.sqlite.JDBC");
         Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db");
         Statement stat = conn.createStatement();
         ResultSet rs = stat.executeQuery("SELECT Question, Answer, Type FROM Questions");
         while (rs.next()) {
            System.out.println(rs.getString("1"));
            System.out.println(rs.getString("2"));
            System.out.println(rs.getString("3"));
         }
         rs.close();
         conn.close();
  }
}

2 thoughts on “Akses SQLite menggunakan JDBC (java)

  1. Thanks ya mas buat kode programnya …. Bisa dicaplokkan mas? Soalnya mau digunakan untuk buat aplikasi nih.

    :D

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s