RuslanK

mdb

Oct 29th, 2020 (edited)
630
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2. import java.sql.*;
  3.  
  4. public class Main {
  5.  
  6.     public static void main(String[] args) {
  7.         try{
  8.             Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
  9.  
  10.             String path = "g:\\docs\\Db.accdb";
  11.             String url = "jdbc:ucanacces:\\" + path;
  12.  
  13.             Connection con = DriverManager.getConnection(url);
  14.             try{
  15.                 Statement st = con.createStatement();
  16.                 ResultSet rs = st.executeQuery("SELECT * FROM Фото");
  17.  
  18.                 while (rs.next()){
  19.                     System.out.println(rs.getString(1));
  20.                 }
  21.             } catch (Exception ex) {
  22.                 System.out.println("error "+ex);
  23.             }
  24.         } catch (Exception ex) {
  25.             System.out.println("error "+ex);
  26.         }
  27.     }
  28. }
  29.  
RAW Paste Data