Skip to content

Instantly share code, notes, and snippets.

@muhomerdogu
Created July 15, 2021 06:36
Show Gist options
  • Save muhomerdogu/09535d55d71262794e18726f363ebd69 to your computer and use it in GitHub Desktop.
Save muhomerdogu/09535d55d71262794e18726f363ebd69 to your computer and use it in GitHub Desktop.
package Test_1;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Test_2 {
static String userName="root";
static String password="As123456";
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