Created
July 14, 2021 17:55
-
-
Save muhomerdogu/c7b4ae5463a7346a980c4e58221f7cb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.SQLException; | |
public class Test_2 { | |
static String userName="root"; | |
static String password="Ab123456"; | |
static String dbUrl="jdbc:mysql://localhost:3306/world"; | |
public static void main(String[] args) throws SQLException { | |
Connection connection=null; | |
try{ | |
connection= DriverManager.getConnection(dbUrl,userName,password); | |
System.out.println("başarılıdır"); | |
} catch (SQLException exception) { | |
exception.printStackTrace(); | |
}finally{ | |
connection.close(); | |
System.out.println("Bağlantı kapatılmıştır"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment