daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Feb 21st, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.sql.*;
  2. import java.util.*;
  3.  
  4.  
  5.  
  6. public class Verzeichniss {
  7.    
  8.     public static void main(String[] args) {
  9.        
  10.         String dbUrl = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)} ;DBQ=h:/Eigene Dateien/Microsoft Office/Access/SQL-Test.mdb";
  11.         int zahl = 0;
  12.         try {
  13.            
  14.             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  15.             Connection conn = DriverManager.getConnection( dbUrl, "login", "password");
  16.             System.out.println("Connected");
  17.             Statement stmt = conn.createStatement();
  18.             stmt = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE );
  19.             String sqlQuery = "SELECT Title, UId, FolderId FROM dbo_Entries";
  20.             ResultSet rSet = stmt.executeQuery( sqlQuery );
  21.             ResultSet rSetKopie = rSet;
  22.            
  23.             String Title = null, UID = null, FolderID = null;
  24.             String tmp= null;
  25.             int zaehler = 0;
  26.  
  27.             rSet.last();
  28.             int rows = rSet.getRow();
  29.             rSet.beforeFirst();
  30.            
  31.             String[] verz = new String[rows];
  32.             System.out.println("\nHier bin ich: " + rows);
  33.            
  34.             while ( rSet.next() ){                 
  35.                 try {
  36.                    
  37.                     verz[zaehler] = getueberOrdner(rSet.getString(3), rSetKopie) + rSet.getString(1);
  38.                     zaehler++;
  39.                    
  40.                
  41.                 }
  42.                 catch (Exception e) {
  43.    
  44.            
  45.                 }              
  46.             }
  47.            
  48.             rSet.close();
  49.             stmt.close();
  50.             conn.close();
  51.         }
  52.         catch (Exception e) {
  53.            
  54.             e.printStackTrace();
  55.         }
  56.     }
  57. }
  58.  
  59.  
  60. static String getueberOrdner(String FolderID, ResultSet rSet)   {
  61.     if ( FolderID == "") {
  62.         while ( rSet.next() )   {
  63.             if ( rSet.getBytes(2).equals(FolderID))
  64.                 return ( getueberOrdner()+ "/" + rSet.getString(1));
  65.         }
  66.     }
  67.     return ("");
  68. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top