Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //package JDBCPackage;
- import java.sql.*;
- public class DAL {
- public static void main(String[ ] args) throws SQLException {
- try {
- // Ladda Oracle JDBC driver
- DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());
- } catch(Exception e) { System.out.println("Kan inte database driver class: " + e);}
- try {
- //syntax : <host>:<port>:<sid>.
- Connection con =
- DriverManager.getConnection
- ("jdbc:sqlserver://localhost:1433;" + "databaseName=Skola;user=sa;password=generation92;");
- if (con == null)
- System.out.println("No driver found!");
- else
- System.out.println("Connection Established - SUCCESS!");
- } catch(Exception e) { System.out.println("Kaaaaaaaan inte hitta database driver class: " + e);}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement