Created
July 15, 2021 03:57
-
-
Save muhomerdogu/d0bfc2628ebf3b0aab70dcfc1e14ea09 to your computer and use it in GitHub Desktop.
This file contains hidden or 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_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