package database; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class OracleConnection{ public static Connection getConnection() { Connection myConnection = null; String userName, password, service, url; userName = "vehiculefleetdb" ; password = "123" ; service = "localhost" ; url = "jdbc:oracle:thin:"; try { myConnection = DriverManager.getConnection(url + userName + "/" + password + "@" + service); System.out.println(" Connection successfull"); } catch (SQLException ex) { ex.printStackTrace(); System.out.println(" Connection failed "); } return myConnection; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter