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.

Probleme beim Einrichten der JDBC Treiber

Empfohlene Antworten

Veröffentlicht

Hallo Leute,

ich habe ein riesen Problem mit JDBC. Ich verwende Eclipse und möchte von meinem Programm aus auf eine MySql Datenbank zugreifen. Dazu habe ich mir den MySql Connector J runtergeladen.

Ich bekomme es einfach nicht auf die Reihe. Kann mir einer in einfachen Schritten sagen wie ich diesen Treiber in meinem System (Windows XP Pro) "integriere" damit es zukünftig auch geht??? Ich wäre euch wirklich sehr dankbar!!

Hier noch ein Ausschnitt aus dem Quellcode den ich zum testen geschrieben habe...

public class Main {

public static void LoadDriver() {

try { Class.forName("com.mysql.jdbc.Driver").newInstance(); }

catch (Exception ex) { }

}

public static void main(String[] args) {

LoadDriver();

try {

Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test?user=monty&password=greatsqldb");

conn.close();

} catch (SQLException ex) {

System.out.println("SQLException: " + ex.getMessage());

System.out.println("SQLState: " + ex.getSQLState());

System.out.println("VendorError: " + ex.getErrorCode());

}

}

}

Dieser Quelltext erzeugt folgende Ausgabe:

SQLException: No suitable driver

SQLState: 08001

VendorError: 0

Ich wäre euch wirklich sehr dankbar wenn irh mir da helfen würdet!

MfG Roman

Hi,

im Projectverzeichnis am besten einen Ordner lib anlegen.

Die jar Datei aus dem Treiber zip dahin kopieren.

Dann Rechte Maustaste auf das Projekt -> refresh

Dann Rechte Maustaste auf das Projekt -> Properies -> java build path -> libraries -> add jars -> und dort zum lib Ordner navigieren und das jar auswählen.

Nun sollte der Driver gefunden werden.

Gruß Jaraz

PS: catch (Exception ex) { }

Das solltest du übrigens nicht machen, so siehst du nie was, falls was schief läuft.

... es hat geklappt :uli

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.