Frage zur Ausführung eines Programms in Eclipse

Ok, sorry nochmal

at java.sql.DriverManager.getConnection(DriverManager.java:579)
-> Fehler : Connection con = aDriver.driver.connect(url, info);
Java:
        SQLException reason = null;

        for(DriverInfo aDriver : registeredDrivers) {
            // If the caller does not have permission to load the driver then
            // skip it.
            if(isDriverAllowed(aDriver.driver, callerCL)) {
                try {
                    println("    trying " + aDriver.driver.getClass().getName());
                    Connection con = aDriver.driver.connect(url, info);
                    if (con != null) {
                        // Success!
                        println("getConnection returning " + aDriver.driver.getClass().getName());
                        return (con);
                    }
                } catch (SQLException ex) {
                    if (reason == null) {
                        reason = ex;
                    }
                }

at java.sql.DriverManager.getConnection(DriverManager.java:243)

Fehler: Connection con = aDriver.driver.connect(url, info);

Java:
   public static Connection getConnection(String url)
        throws SQLException {

        java.util.Properties info = new java.util.Properties();

        // Gets the classloader of the code that called this method, may
        // be null.
        ClassLoader callerCL = DriverManager.getCallerClassLoader();

        return (getConnection(url, info, callerCL));
    }


at de.iph.EasyFunCalc.database.Database.<init>(Database.java:25)

Fehler: connection = DriverManager.getConnection(CONN_STRING);

Java:
	public static synchronized Database getInstance() throws SQLException {
		if(instance == null) instance = new Database();
		return instance;
	}
	
	private Database() throws SQLException {
		connection = DriverManager.getConnection(CONN_STRING);
		StatusBar.getInstance().setText(3, "Datenbank verbunden");
	}
	
	public PreparedStatement prepareStatement(String sql) throws SQLException {
		return connection.prepareStatement(sql);
	}
	
	public void close() throws SQLException {
		if(!locked) {
			connection.close();
			instance = null;
		} else closeWhenUnlock = true;
	}

at de.iph.EasyFunCalc.database.Database.getInstance(Database.java:20)

Fehler: if(instance == null) instance = new Database();

Java:
private boolean locked = false;
	private boolean closeWhenUnlock = false;
	
	public static synchronized Database getInstance() throws SQLException {
		if(instance == null) instance = new Database();
		return instance;
	}
	
	private Database() throws SQLException {
		connection = DriverManager.getConnection(CONN_STRING);
		StatusBar.getInstance().setText(3, "Datenbank verbunden");
	}


at de.iph.EasyFunCalc.gui.maintenance.CustomerPanel.update(CustomerPanel.java:102)

Fehler: for(Customer customer: Database.getInstance().getCustomers()) {

Java:
public void update(int selectID) throws SQLException {
		if(parent != null) this.project = parent.getProject();
		listModel.removeAllElements();
		Customer select = null;
		for(Customer customer: Database.getInstance().getCustomers()) {
			listModel.addElement(customer);
			if(customer.getDatabaseID() == selectID) select = customer;
		}
		getList().setSelectedValue(select, true);
		getList().repaint();
		if(select == null) getSelectButton().setEnabled(false);
	}

at de.iph.EasyFunCalc.gui.maintenance.CustomerPanel.<init>(CustomerPanel.java:74)

Fehler: update(0);

Java:
public CustomerPanel(Maintenance parent) throws SQLException {
		this.parent = parent;
		nameField = new LimitedTextField(GUI.MAX_LABEL_LENGTH, GUI.FIELD);
		nameField.addKeyListener(getKeyListener());
		contactPersonField = new LimitedTextField(GUI.MAX_LABEL_LENGTH, GUI.FIELD);
		contactPersonField.addKeyListener(getKeyListener());
		adress1Field = new LimitedTextField(GUI.MAX_LABEL_LENGTH, GUI.FIELD);
		adress1Field.addKeyListener(getKeyListener());
		adress2Field = new LimitedTextField(GUI.MAX_LABEL_LENGTH, GUI.FIELD);
		adress2Field.addKeyListener(getKeyListener());
		this.setPreferredSize(new Dimension(360, 210));
		this.setBorder(BorderFactory.createTitledBorder("Kunde"));
		this.setLayout(new BorderLayout());
		this.add(getButtonPanel(), BorderLayout.NORTH);
		JScrollPane scrollPane = new JScrollPane(getList());
		scrollPane.setPreferredSize(GUI.LIST);
		this.add(scrollPane, BorderLayout.LINE_START);
		this.add(getCenterPanel(), BorderLayout.CENTER);
		getSaveButton().setEnabled(false);
		getDeleteButton().setEnabled(false);
		update(0);
	}

at de.iph.EasyFunCalc.gui.maintenance.Maintenance.<init>(Maintenance.java:31)

Fehler: customerPanel = new CustomerPanel(this);

Java:
public Maintenance(GUI gui) throws SQLException {
		this.gui = gui;
		detailsPanel = new DetailsPanel(this);
		customerPanel = new CustomerPanel(this);
		assemblyPanel = new AssemblyPanel(this);
		processPanel = new ProcessPanel(this);
		partPanel = new PartPanel(this);
		attributePanel = new AttributePanel(this);
		functionPanel = new FunctionPanel(this);
		this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		JPanel firstPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
		firstPanel.add(detailsPanel);
		firstPanel.add(customerPanel);
		this.add(firstPanel);
		JPanel secondPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
		secondPanel.add(processPanel);
		secondPanel.add(assemblyPanel);
		secondPanel.add(partPanel);
		this.add(secondPanel);

at de.iph.EasyFunCalc.gui.GUI.<init>(GUI.java:56)

Fehler: maintenance = new Maintenance(this);

Java:
public GUI() {
		super("EasyFunCalc");
		this.setMinimumSize(new Dimension(1200, 900));
		this.setLocationRelativeTo(null);
		this.addWindowListener(this);
		this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
		setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource(GUI.IMG_PATH + "logo.png")));
		navigationPanel = new NavigationPanel(this);
		welcomePanel = navigationPanel.getWelcomePanel();
		try {
			projectPanel = new ProjectPanel(this);
			maintenance = new Maintenance(this);
			overview = new Overview(this);
			calculation = new Calculation();
		} catch (SQLException exception) {
			MessageHandler.getInstance().showException(exception);
			System.exit(0);
		}
		this.setLayout(new CardLayout());
		this.add(welcomePanel, WELCOME);
		this.add(getContentPanel(), CONTENT);
		MessageHandler.getInstance().setParent(this);

at de.iph.EasyFunCalc.gui.GUI.main(GUI.java:137)

Fehler: GUI gui = new GUI();

Java:
	public void windowClosing(WindowEvent event) {
		dispose();
	}
	
	public void windowDeactivated(WindowEvent event) {}
	public void windowDeiconified(WindowEvent event) {}
	public void windowIconified(WindowEvent event) {}
	public void windowOpened(WindowEvent event) {}
	
	public static void main(String[] args) {
		GUI gui = new GUI();
		gui.setVisible(true);
	}
}

Danke sehr !
 
Zuletzt bearbeitet:
Hi.
Code:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Datei '(unbekannt)' nicht gefunden.
Das heißt einfach nur, das die Datenbank-Datei, die du in deinem Connection-String angegeben hast bzw. als Datenquelle in ODBC eingetragen hast, nicht gefunden werden konnte.

Bitte verwende für Code keine Zitat-Tags. Danke.

Gruß
 
Ich hab gerade gesucht und leider "create odbc code.." nicht in code gefunden.


Java:
public class Database {
	private static Database instance;
	private final static String CONN_STRING = "jdbc:odbc:EasyFunCalc_DB";
	private Connection connection;
	private boolean locked = false;
	private boolean closeWhenUnlock = false;
	
	public static synchronized Database getInstance() throws SQLException {
		if(instance == null) instance = new Database();
		return instance;
	}
	
	private Database() throws SQLException {
		connection = DriverManager.getConnection(CONN_STRING);
		StatusBar.getInstance().setText(3, "Datenbank verbunden");
	}
	
	public PreparedStatement prepareStatement(String sql) throws SQLException {
		return connection.prepareStatement(sql);
	}
 

Neue Beiträge

Zurück