Created
July 15, 2021 06:36
-
-
Save muhomerdogu/b3a8d83025f772ce7712060bc5af2bc9 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 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