Advertisement
Guest User

Untitled

a guest
Feb 24th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. package HotelVerkefni;
  2. import java.sql.*;
  3. import javax.swing.*;
  4.  
  5.  
  6.  
  7. public class sqliteConnection {
  8.  
  9. static Connection conn=null;
  10.  
  11.  
  12.  
  13. public static Connection dbConnector(){
  14.  
  15. try{
  16.  
  17. Class.forName("org.sqlite.JDBC");
  18. //String dbPath = "jdbc:sqlite:" + conn.getDir() + conn.getSeparator() + "wc.db";
  19. Connection conn = DriverManager.getConnection("jdbc:sqlite:/C:/sqlite/wc.db");
  20. JOptionPane.showMessageDialog(null, "Tengingin tókst");
  21.  
  22. return conn;
  23. }catch(Exception e){
  24.  
  25. JOptionPane.showMessageDialog(null, e);
  26. return null;
  27. }
  28. }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement