0% found this document useful (0 votes)
26 views10 pages

Tutorial JDBC SQL Server

This document provides instructions for downloading and configuring the MySQL JDBC driver in NetBeans to connect to a SQL Server database. It describes extracting the driver files, adding the JAR library to a project, setting the classpath, and includes sample connection code.

Uploaded by

Arcom Poerba
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
0% found this document useful (0 votes)
26 views10 pages

Tutorial JDBC SQL Server

This document provides instructions for downloading and configuring the MySQL JDBC driver in NetBeans to connect to a SQL Server database. It describes extracting the driver files, adding the JAR library to a project, setting the classpath, and includes sample connection code.

Uploaded by

Arcom Poerba
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1/ 10

Ditulis oleh : Yuliusman Kurniawan <uuzkurniawan@yahoo.com> Download MySQL JDBC driver dari web nya microsoft (sqljdbc_3 ! "3!

" "!"_en#$

%&tract file driver 'asil download Berdasar(an note dari 'asil e&tract) dire(omendasi(an file 'asil e&tract lo(asi nya ada di folder program files) den*an nama directory defa#lt + jan*an dir#ba') yait# Microsoft S ! Ser"er #D$% Dri"er &.'

,asil di la-to- saya .D

Lan*(a' selanj#t nya b#(a man#al yan* ada di folder 'asil e&tract tadi /da di dire(tori. C.01ro*ram 2iles0Microsoft SQL Server JDBC Driver 3 !0sqljdbc_3 !0en#0'el3an* -ertama adala' system req#irement Dari 'asil e&tract terda-at 4 b#a' file jar+library

Bila jre yan* di*#na(an J5% 6 ! ma(a *#na(an s(l)*+c.)ar. Bila jre yan* di*#na(an J5% 7 ! ma(a *#na(an s(l)*+c,.)ar for man#al .

b#at -roject bar# di netbeans) lal# add library + jar Ber'#b#n* J5% y* saya *#na(an J5% 7 ! jd y* saya -a(ai adala' s(l)*+c,.)ar

Selanj#tnya set CL/SS1/8,

Cara nya.

9ni *ambar nya.

B#(a sql server mana*ement st#dio : connect

B#at DB bar# ata# attac' file mdf bila s#da' ada (ber'#b#n* saya s#da' ada file mdf biar ce-at saya attac' saja$ 8#j#an nya adala' nantinya nama db ini dib#t#'(an dalam -emb#atan class #t( tes (one(si

DB saya s#da' mas#( .D Selanj#tnya -ada object e&-lore) e&-and tree sec#rity ) lal# (li( (anan -ada lo*in) b#at new lo*in

9sila' lo*in name) -assword) defa#lt DB men#nj#( (e DB yan* tadi (ita b#at

Jadila' " b#a' #ser bar# .D

Se(aran* (embali (e netbeans) b#at seb#a' class #nt#( test (one(si 9ni conto' so#rcecode nya.

Biar *a ca-e n*eti( .1


import java.sql.*; public class MyConnection { public static Connection getConnection() { Connection con = null; try { Class.forName( com.microsoft.j!bc.sqlserver."#$"erver%river ); "tring url = j!bc&sqlserver&''local(ost&)*)+'",-- ; "tring user = !ariuu. ; "tring pass = ra(asia ; con = %riverManager.getConnection(url/ user/ pass); 0 catc( (ClassNot1oun!23ception e) { "ystem.out.println(e.getMessage()); "ystem.e3it(4); 0 catc( ("#$23ception e) { "ystem.out.println(e.getMessage()); "ystem.e3it(4); 0 return con; 0 public static voi! main("tring56 args) { Connection con = MyConnection.getConnection(); "ystem.out.print(con); 0 0

/('ir dari t#torial) (li( (anan : r#nfile .1

Selamat anda tela' ber'asil men*(one(si (an jdbc via sqlserver .D

You might also like