Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
4Activity
0 of .
Results for:
No results containing your search query
P. 1
Pertemuan 10(PreperedStatement Proses Select)

Pertemuan 10(PreperedStatement Proses Select)

Ratings: (0)|Views: 1,470|Likes:
Published by Kang Asep
modul java databases
modul java databases

More info:

Published by: Kang Asep on Sep 13, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

06/03/2013

pdf

text

original

 
 Java Database Programing 1Asep Komarudin
PROSES INSERT DENGAN PREPAREDSTATEMENT
Selain proses INSERT,UPDATE danDELETE PreparedStatement juga dapatmelakukan prosesSELECT sepertihalnya ResultSet .Sekarang kita coba untukmendapatkan data dari table identitas.package asep.aplikasiBuku.coneksi;import java.sql.Connection;import java.sql.Date;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;import java.util.logging.Level;import java.util.logging.Logger;/**** @author asep teea*/public class Coneksi {/*** @param args the command line arguments*/public static void main(String[] args) {try {// TODO code application logic hereClass.forName("com.mysql.jdbc.Driver").getInterfaces();
aasseepp@gmail.comPage 1
 
String usr="root";String password="root";Connection connection=DriverManager.getConnection("jdbc:mysql://localhost:3306/asep",usr, password);
PreparedStatement prepare=connection.prepareStatement("select * from identitas");ResultSet rs=prepare.executeQuery();while(rs.next()){String id=rs.getString("ID");String nama=rs.getString("NAMA");Date d=rs.getDate("TANGGAL_LAHIR");String alamat=rs.getString("ALAMAT");String kontak=rs.getString("KONTAK");System.out.println(" id="+id);System.out.println("nama ="+nama);System.out.println("tanggal lahir="+d);System.out.println("alamat ="+alamat);System.out.println("kontak ="+kontak);System.out.println("-----------------------------");
} } catch (SQLException ex) {Logger.getLogger(Coneksi.class.getName()).log(Level.SEVERE, null, ex);

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->