{"id":219,"date":"2010-08-28T00:57:00","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"http:\/\/www.yazilimmutfagi.com\/?p=219"},"modified":"2010-08-28T00:57:00","modified_gmt":"1970-01-01T00:00:00","slug":"java-ile-sql-veritabani-baglantisi","status":"publish","type":"post","link":"https:\/\/www.yazilimmutfagi.com\/index.php\/2010\/08\/28\/java-ile-sql-veritabani-baglantisi\/","title":{"rendered":"Java ile SQL veritabani baglantisi"},"content":{"rendered":"<div><span style=\"font-size:10.0pt;line-height:115%;font-family:\n&quot;Courier New&quot;\">Merhaba arkadaslar, bu makalede Java ile SQL veritabanina nasil baglanilacagini anlatmaya &ccedil;alisacagim. <\/span><\/div>\n<div><span style=\"font-size:10.0pt;line-height:115%;font-family:\n&quot;Courier New&quot;\">Uzun uzadiya teorik bilgiler vermeyecegim. Onun i&ccedil;in hemen ise koyuluyorum.<\/span><\/div>\n<div><span style=\"font-size:10.0pt;line-height:115%;font-family:\n&quot;Courier New&quot;\">Ilk yapacagimiz is bir baglanti driveri olusturmak. Bu driver sayesinde SQL&rsquo;e baglanip islemlerimizi ger&ccedil;eklestirebilecegiz.<\/span><\/div>\n<div><strong><span style=\"font-size:10.0pt;line-height:115%;font-family:\n&quot;Courier New&quot;\">Denetim masasi &gt; Sistem y&ouml;netimi<\/span><\/strong><span style=\"font-size:10.0pt;line-height:115%;font-family:\n&quot;Courier New&quot;\">&rsquo;nden <strong><span style=\"color:black\">OBDC Veri Kaynagi Y&ouml;neticisi (ODBC Data Source Administrator)<\/span><\/strong><span style=\"color:black\"> tikliyoruz. <\/span><\/span>&nbsp;<\/div>\n<div><span style=\"font-size:10.0pt;\nline-height:115%;font-family:&quot;Courier New&quot;;color:black\">Karsimiza &ccedil;ikan ekrandan <b>dBASE Files <\/b>se&ccedil;enegini tikliyor ve <b>ekle<\/b> diyoruz (benimkinde <i>toevoegen<\/i> yaziyor). <\/span><\/div>\n<div>&nbsp;<\/div>\n<div><img decoding=\"async\" loading=\"lazy\" width=\"470\" height=\"420\" alt=\"\" src=\"http:\/\/www.yazilimmutfagi.com\/yuklenendosyalar\/image\/ODBC%201.png\" \/><\/div>\n<div>&nbsp;<\/div>\n<div><span style=\"font-size:10.0pt;\nline-height:115%;font-family:&quot;Courier New&quot;;color:black\">Buradan da <b>SQL Server <\/b>se&ccedil;enegini tikliyor ve <b>tamam<\/b> diyoruz.<\/span><\/div>\n<div><a href='www.yazilimmutfagi.com'>.<\/a><\/div>\n<div><img decoding=\"async\" loading=\"lazy\" width=\"0\" height=\"0\" alt=\"\" src=\"http:\/\/www.yazilimmutfagi.com\/yuklenendosyalar\/image\/ODBC%202.png\" \/><\/div>\n<div><img decoding=\"async\" loading=\"lazy\" width=\"0\" height=\"0\" alt=\"\" src=\"http:\/\/www.yazilimmutfagi.com\/yuklenendosyalar\/image\/ODBC%202.png\" \/>&nbsp;<img decoding=\"async\" loading=\"lazy\" width=\"490\" height=\"361\" alt=\"\" src=\"http:\/\/www.yazilimmutfagi.com\/yuklenendosyalar\/image\/ODBC%202.png\" \/><\/div>\n<div>&nbsp;<\/div>\n<div><span style=\"font-size:10.0pt;\nline-height:115%;font-family:&quot;Courier New&quot;;color:black\">Karsimiza &ccedil;ikan &uuml;&ccedil;&uuml;nc&uuml; ekranda, altta kullandigimiz <b>server<\/b>&rsquo;i se&ccedil;iyoruz ve baglantimiza herhangi bir <b>isim<\/b> veriyoruz (en &uuml;stte). Sonra <b>ileri<\/b> diyoruz.<\/span><\/div>\n<div><img decoding=\"async\" loading=\"lazy\" width=\"520\" height=\"369\" alt=\"\" src=\"http:\/\/www.yazilimmutfagi.com\/yuklenendosyalar\/image\/ODBC%203.png\" \/>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div><span style=\"font-size:10.0pt;\nline-height:115%;font-family:&quot;Courier New&quot;;color:black\">Bir sonraki se&ccedil;enekte serverimize windows oturumu ile mi yoksa sifre ile mi erisecegimizi soruyor. Ben windows oturumunu tercih ediyorum.<\/span><\/div>\n<div><img decoding=\"async\" loading=\"lazy\" width=\"519\" height=\"367\" alt=\"\" src=\"http:\/\/www.yazilimmutfagi.com\/yuklenendosyalar\/image\/ODBC%204.png\" \/>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div><span style=\"font-size:10.0pt;\nline-height:115%;font-family:&quot;Courier New&quot;;color:black\">Bundan sonraki adimda hangi veritabanina baglanacagimizi se&ccedil;ecegiz.<\/span><\/div>\n<div><img decoding=\"async\" loading=\"lazy\" width=\"519\" height=\"367\" alt=\"\" src=\"http:\/\/www.yazilimmutfagi.com\/yuklenendosyalar\/image\/ODBC%205.png\" \/>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div><span style=\"font-size:10.0pt;\nline-height:115%;font-family:&quot;Courier New&quot;;color:black\">En son olarak dil se&ccedil;imini de yaptiktan sonra islemimiz tamamlanmis olacak.<\/span><\/div>\n<div>&nbsp;<\/div>\n<div><span style=\"font-size:10.0pt;\nline-height:115%;font-family:&quot;Courier New&quot;;color:black\">Simdi bunu nasil kullanacagimizi, yani java ile sql&rsquo;e nasil baglanacagimizi g&ouml;recegiz.<\/span><\/div>\n<div><a href='www.yazilimmutfagi.com'>.<\/a><\/div>\n<div style=\"border:solid windowtext 1.0pt;padding:1.0pt 4.0pt 1.0pt 4.0pt;\nbackground:#D9D9D9;\">\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">import<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\"> java.sql.*;<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">import<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\"> java.io.*; <\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\">&nbsp;<\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">public&nbsp;<\/span><\/b><b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">class<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\"> SQLBaglantisi{<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><b><span style=\"font-size:10.0pt;\nfont-family:&quot;Courier New&quot;;color:#7F0055\">public&nbsp;<\/span><\/b><b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">static<\/span><\/b><b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">void<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\"> main(String[] arg) <\/span><b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;\ncolor:#7F0055\">throws<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;\ncolor:black\"> IOException, SQLException{<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i>baglan<\/i>();<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\">&nbsp;<\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp; <\/span><b><span style=\"font-size:10.0pt;\nfont-family:&quot;Courier New&quot;;color:#7F0055\">public&nbsp;<\/span><\/b><b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">static<\/span><\/b><b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">void<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;baglan() <\/span><b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">throws<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\"> IOException, SQLException{ <\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String url = <\/span><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;\ncolor:#2A00FF\">&quot;jdbc:odbc:northwind&quot;<\/span><span style=\"font-size:\n10.0pt;font-family:&quot;Courier New&quot;;color:black\">;<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Connection con;<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Statement stm;<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ResultSet sonuc;<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String Ssql;<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;Ssql = <\/span><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;\ncolor:#2A00FF\">&quot;SELECT * FROM Orders&quot;<\/span><span style=\"font-size:\n10.0pt;font-family:&quot;Courier New&quot;;color:black\">;<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\">&nbsp;<\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><b><span style=\"font-size:\n10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">try<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">{<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Class.<i>forName<\/i>(<\/span><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#2A00FF\">&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;<\/span><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">);<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><b><span style=\"font-size:\n10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">catch<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">(java.lang.ClassNotFoundException e){ <\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.<\/span><i><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#0000C0\">err<\/span><\/i><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">.print(<\/span><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#2A00FF\">&quot;ClassNotFoundException: &quot;<\/span><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;\ncolor:black\">);<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.<\/span><i><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#0000C0\">err<\/span><\/i><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">.print(e.getMessage());<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><b><span style=\"font-size:\n10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">try<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">{<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con = DriverManager.<i>getConnection<\/i>(url);<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stm = con.createStatement();<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sonuc = stm.executeQuery(Ssql);<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">while<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">(sonuc.next()){<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.<\/span><i><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#0000C0\">out<\/span><\/i><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">.println(sonuc.getString(2));<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#00B050\">\/\/Birinci ve ikinci s&uuml;tundaki verileri se&ccedil;iyorum<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stm.close();<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.close();<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><b><span style=\"font-size:\n10.0pt;font-family:&quot;Courier New&quot;;color:#7F0055\">catch<\/span><\/b><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">(SQLException ex){&nbsp;<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.<\/span><i><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#0000C0\">err<\/span><\/i><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">.print(<\/span><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#2A00FF\">&quot;SQLException: &quot;<\/span><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;\ncolor:black\">+ex.getMessage());<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp; &nbsp;}<\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/div>\n<div style=\"margin-bottom:0cm;margin-bottom:.0001pt;line-height:\nnormal;background:#D9D9D9;text-autospace:none;border:none;padding:0cm;\"><span style=\"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/div>\n<div style=\"background:#D9D9D9;border:none;\npadding:0cm;\"><span style=\"font-size:\n10.0pt;line-height:115%;font-family:&quot;Courier New&quot;;color:black\">}<\/span><\/div>\n<\/div>\n<div>&nbsp;<\/div>\n<div>\n<p class=\"MsoNormal\"><span style=\"font-size:10.0pt;line-height:115%;font-family:\n&quot;Courier New&quot;;color:black\">Ekran &ccedil;iktisi olarak ilk iki s&uuml;tunu g&ouml;stermis olacagiz.<o:p><\/o:p><\/span><\/p>\n<\/div>\n<div><span style=\"font-size:10.0pt;\nline-height:115%;font-family:&quot;Courier New&quot;;color:black\">Insallah bundan sonraki dersimizde de Jtable kullanarak baglandigimiz veritabanimizdan verileri Jtable&rsquo;de g&ouml;sterecegiz.<\/span><\/div>\n<div><span style=\"font-size:10.0pt;\nline-height:115%;font-family:&quot;Courier New&quot;;color:black\">Ayrintiliri sorularinizi forum sayfamizda iletebilirsiniz.<\/span><\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div><span style=\"font-size:10.0pt;line-height:115%;font-family:\n&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#333333\"><br \/>\n<\/span>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Merhaba arkadaslar, bu makalede Java ile SQL veritabanina nasil baglanilacagini anlatmaya &#231;alisacagim.<\/p>\n","protected":false},"author":519,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[419],"tags":[4592,5559,4925,4189,5326],"_links":{"self":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts\/219"}],"collection":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/users\/519"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/comments?post=219"}],"version-history":[{"count":0,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts\/219\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/media?parent=219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/categories?post=219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/tags?post=219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}