Skip to content

Instantly share code, notes, and snippets.

@muhomerdogu
Created July 15, 2021 03:57
Show Gist options
  • Save muhomerdogu/d0bfc2628ebf3b0aab70dcfc1e14ea09 to your computer and use it in GitHub Desktop.
Save muhomerdogu/d0bfc2628ebf3b0aab70dcfc1e14ea09 to your computer and use it in GitHub Desktop.
package com.company;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Test_3 {
//diğer adı DbHelper olarak anılır.
private static String userName="root";
private static String password="Ab123456";
private static String dbUrl="jdbc:mysql://localhost:3306/world";
public Connection getConnection() throws SQLException {
return DriverManager.getConnection(dbUrl,userName,password);
}
public void showErrorMessage(SQLException exception)
{
System.out.println("Error:"+exception.getMessage());//hatayı döndürür ekrana.ç
System.out.println("Error Code: "+exception.getErrorCode());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment