Skip to content

Instantly share code, notes, and snippets.

@muhomerdogu
Created July 15, 2021 06:36
Show Gist options
  • Save muhomerdogu/b3a8d83025f772ce7712060bc5af2bc9 to your computer and use it in GitHub Desktop.
Save muhomerdogu/b3a8d83025f772ce7712060bc5af2bc9 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_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