Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo,

bräuchte dringend Hilfe. Ich versuche in Java eine DB-Verbindung mit meiner MySQL-DB herzustellen, nur leider bekomme ich schon beim Laden der ODBC-Treiber ein negatives Ergebnis, kann mir jeman sagen, was ich falsch mache. Hier ein Auszug aus meinem Quellcode:

code:

import java.sql.*;

public class Verb {

public Connection con = null;

static final String DRIVER = "com.mysql.jdbc.Driver";

public void verbinden(){

// Treiber laden

try {

Class.forName(DRIVER).newInstance();

} catch (Exception ex ) {

System.out.println("Der JDBC-Treiber konnte nicht " +

"geladen werden.");

System.exit(1);

}

... usw.

Unter Systemsteuerung > Verwaltung > ODBC > Treiber habe ich nachgeschaut die MySQL Treiber sind da. Was habe ich vergessen?

Danke im Voraus

was meinst du damit?? wo soll ich schauen? :confused:

Versuchs mal mit e.printStackTrace();

Mich würde es nicht wundern, wenn es eine ClassNotFoundException ist, weil du evtl. die JDBC-Pakete nicht korrekt ins Projekt eingebunden hast.

Den try-catch wegzulassen ist meiner Meinung nach ziemlich unnötig.

Es können zwei Probleme auftreten, die beide aller Wahrscheinlichkeit nach auf dasselbe hinauslaufen, was speedi bereits sagte: Die mysql-JAR muss in ClassPath!

Class.forName(): bringt 3 Fehler, ClassNotFoundException, Link-Exception und Initialisierungs-Exception

und newInstance(): Instanziierungs-Exception und Illegal-Exception

Danke es war eine ClassNotFoundException.

Learning by doing! Danke nochmals!:nett:

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.