1. Dashboard
  2. Forum
    1. Unerledigte Themen
  3. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team-Mitglieder
    4. Trophäen
    5. Mitgliedersuche
  4. Tutorial Bereich
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Seiten
  • Forum
  • Lexikon
  • Erweiterte Suche
  1. Informatik Forum
  2. Mitglieder
  3. nphs

Beiträge von nphs

  • JDBC/MySql - java.sql.SQLException: No suitable driver

    • nphs
    • 17. Dezember 2006 um 16:35

    omg es GEHT !!!!!!!!!!!!!!!!!!
    ich habe xampp nochmal neuinstalliert und diesen einen trick da verwendet von wegen utf8 blubb ! und nun geht es ! gelobt sei der herr ;D

    danke danke danke danke danke danke danke danke

  • JDBC/MySql - java.sql.SQLException: No suitable driver

    • nphs
    • 17. Dezember 2006 um 16:31

    jo dankeschoen .. das war dumm von mir ..

    naja, nun krieg ich nen neuen fehler:

    Code
    init:
    deps-jar:
    Compiling 1 source file to C:\Dokumente und Einstellungen\advanced\JavaApplication5\build\classes
    compile-single:
    run-single:
    java.sql.SQLException: Unknown initial character set index '48' received from server. Initial client character set can be forced via the 'characterEncoding' property.
            at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
            at com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2345)
            at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:3913)
            at com.mysql.jdbc.Connection.createNewIO(Connection.java:2683)
            at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
            at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
            at java.sql.DriverManager.getConnection(DriverManager.java:525)
            at java.sql.DriverManager.getConnection(DriverManager.java:171)
            at Jdbc01.main(Jdbc01.java:25)
    BUILD SUCCESSFUL (total time: 2 seconds)
    Alles anzeigen

    ich hab auch noch nen anderen quellcode:

    Java
    import java.sql.*;
    
    
    public class sql {
    
        public static void main (String[] args) {
        // JDBC
        Connection           connection = null;
        Statement            statement = null;
    
        // connecten
        System.out.println("connecting...");
    
        try {
    
            // Verbindung zu MySql
    
            // Treiber festlegen
            Class.forName("com.mysql.jdbc.Driver");
    
            // Verbindung aufbauen
            // DB-Name, Kennung, Password
            connection = DriverManager.getConnection
                    ("jdbc:mysql://localhost/laender","root","mietz");
            // Statement für Sql-Befehle erzeugen
            statement = connection.createStatement();
        }
    
        catch (ClassNotFoundException err) {
            System.err.println("/nDB-Driver nicht gefunden");
            System.err.println(err);
        }
    
        catch (SQLException err) {
            System.err.println("\nConnect nicht moeglich");
            System.err.println(err);
        }
    
        }
    
    }
    Alles anzeigen

    und der gibt mir folgende fehlermeldung.

    Code
    init:
    deps-jar:
    Compiling 1 source file to C:\Dokumente und Einstellungen\db\mySql\build\classes
    compile-single:
    run-single:
    connecting...
    
    
    Connect nicht moeglich
    java.sql.SQLException: Unknown initial character set index '48' received from server. Initial client character set can be forced via the 'characterEncoding' property.
    BUILD SUCCESSFUL (total time: 0 seconds)
    Alles anzeigen
  • JDBC/MySql - java.sql.SQLException: No suitable driver

    • nphs
    • 17. Dezember 2006 um 15:30

    Hi ...
    nun, ich bin komplett am verzweifeln. ich probiere mittlerweile seit wochen ein Java Programm zu schreiben, welches auf einer mysql datenbank zugreifen kann. ich habe 3 bis 4 quelltexte die eigentlich richtig sein müssen, trotzdem funktioniert es einfach nicht.

    zu erst hab ich mir das hier runtergeladen -> http://dev.mysql.com/downloads/connector/j/5.0.html

    meine erste frage is: hab ich das richtig installiert ?
    ich habe die datei entpackt und die .jar datei in den C:\Programme\Java\jdk1.5.0_09\lib verschoben. dann habe ich unter systemsteuerung -> system -> erweitert -> umgebungsvariabeln -> systemvariabeln eine neue variabel namens CLASSPATH erstellt und dessen wert auf: C:\Programme\Java\jdk1.5.0_09\lib\mysql-connector-java-5.0.4-bin.jar gesetzt.

    nun hab ich mir erstmal nen vorgefertigen code gesucht umzusehn obs klappt.

    Java
    import java.sql.*;
    
    
    public class Jdbc01 {
      public static void main(String args[]) {
        try {
          Statement stmt;
          ResultSet rs;
    
    
          //Register the JDBC driver
          Class.forName("com.mysql.jdbc.Driver");
    
    
          //Define URL of database server for database named
          // JunkDB by selecting one of the following
          // statements.  I believe that port 1114 is the
          // standard database server port, but I'm not
          // certain.  This value along with the user name and
          // some other information is specified in a file
          // named msql.conf in the Hughes directory which is
          // the installation directory for the mSQL database.
          String url = "jdbc:msql://localhost/laender";
          //String url = "jdbc:msql://localhost:1114/JunkDB";
    
    
    
    
          //Get a connection to the database
          Connection con = DriverManager.getConnection(url,
                                                "root", "mietz");
          //Display URL and connection information
          System.out.println("URL: " + url);
          System.out.println("Connection: " + con);
    
    
          //Get a Statement object
          stmt = con.createStatement();
    
    
          //As a precaution, delete myTable if it already
          // exists as residue from a previous run.  Otherwise,
          // if the table already exists and an attempt is made
          // to create it, an exception will be thrown.
          try{
            stmt.executeUpdate("DROP TABLE myTable");
          }catch(Exception e){
            System.out.print(e);
            System.out.println("No existing table to delete");
          }//end catch
    
    
          //Create a table in the database named myTable.
          stmt.executeUpdate("CREATE TABLE myTable ("
                  + "test_id int,test_val char(15) not null)");
    
    
          //Insert some values into the table
          stmt.executeUpdate("INSERT INTO myTable ("
                       + "test_id, test_val) VALUES(1,'One')");
          stmt.executeUpdate("INSERT INTO myTable ("
                       + "test_id, test_val) VALUES(2,'Two')");
          stmt.executeUpdate("INSERT INTO myTable ("
                     + "test_id, test_val) VALUES(3,'Three')");
          stmt.executeUpdate("INSERT INTO myTable ("
                      + "test_id, test_val) VALUES(4,'Four')");
          stmt.executeUpdate("INSERT INTO myTable ("
                      + "test_id, test_val) VALUES(5,'Five')");
    
    
          //Get another statement object.  This version is
          // compatible with either JDK 1.1 or JDK 1.2, but
          // does not support the rs.absolute(2) statement used
          // later in the JDK 1.2 version.
          stmt = con.createStatement();
    
    
    
    
    /*
          //Get another statement object initialized as shown.
          // This version is compatible with JDK 1.2 but is not
          // compatible with JDK 1.1.  This version is required
          // to support the rs.absolute(2) statement later.
          stmt = con.createStatement(ResultSet.
                                   TYPE_SCROLL_INSENSITIVE,
                                   ResultSet.CONCUR_READ_ONLY);
    */
          //Query the database, storing the result in an object
          // of type ResultSet
          rs = stmt.executeQuery(
                   "SELECT * from myTable ORDER BY test_id");
    
    
          //Use the methods of class ResultSet in a loop
          // to display all of the data in the database.
          System.out.println("Display all results:");
          while(rs.next()) {
            int theInt= rs.getInt("test_id");
            String str = rs.getString("test_val");
            System.out.println("\ttest_id= " + theInt
                                           + "\tstr = " + str);
          }//end while loop
    
    
    /*
          //This block of code only works under JDK 1.2.
          // The absolute() method is not supported by JDK 1.1.
          System.out.println("Display row number 2:");
          if( rs.absolute(2) ) {
            int theInt= rs.getInt("test_id");
            String str = rs.getString("test_val");
            System.out.println("\ttest_id= " + theInt
                                           + "\tstr = " + str);
          }//end if
          //End block supported only by JDK 1.2.
    */
          //Delete the table and close the connection to the
          // database
          stmt.executeUpdate("DROP TABLE myTable");
          con.close();
        }catch( Exception e ) {
          e.printStackTrace();
        }//end catch
      }//end main
    }//end class Jdbc01
    Alles anzeigen

    ich denke mal das nur der anfang hiervon wichtig ist. wenn ich dieses programm starte kriege ich folgende fehlermeldung:

    Code
    init:
    deps-jar:
    compile-single:
    run-single:
    java.sql.SQLException: No suitable driver
            at java.sql.DriverManager.getConnection(DriverManager.java:545)
            at java.sql.DriverManager.getConnection(DriverManager.java:171)
            at Jdbc01.main(Jdbc01.java:25)
    BUILD SUCCESSFUL (total time: 0 seconds)

    irgendwo hab ich das hier gelesen:

    Zitat

    Der Fehler liegt darin dass in der my.cnf von xampp latin1_swedish_ci angegeben ist.
    Ein ersetzen durch z.B. utf8 und utf8_bin behebt das Problem ohne einen alten Driver zu nehmen.

    Regards,
    dj+ji

    das hab ich auch gemacht, jedoch aendert das bei mir nix :frowning_face:

    ich hoffe ihr koennt mir helfen, denn ich sollte das bis heute abend fertig haben.

    danke :)

Rechtliches

Impressum

Datenschutzerklärung