G
Guest
Gast
ich habe eben ja schon einen aufgehabt aba ich habe imma wieda fragen oda so brauch ich den Title nich ändern
habe folgendes Prob bzw es is eins dazu gekommen
[/code]
init:
deps-jar:
Deleted 5 out of date files in 0 seconds
Compiling 3 source files to C:\Dokumente und Einstellungen\User\Desktop\Marco\Java\ConDB\ConDB\build\classes
ich finde den fehlöer nmich also wieso er keine verbindung aufbaut ja ich weiss fragen über fragen bin aba seeehr dankbar
habe ich ne falsche angabe mit der Quelle des Treibers ?
habe folgendes Prob bzw es is eins dazu gekommen
Code:
import java.awt.*;
import java.sql.*;
import java.sql.Connection;
public class DbConnection
{
public DbConnection()
{
}
void connect ()
{
System.out.println("* Treiber laden");
final String hostname = "192.168.*.***";
final String port = "3306";
final String dbname = "Java01";
final String user = "root";
final String password = "*****";
Connection conn = null;
try
{
System.out.println("* Treiber laden");
Class.forName("com.mysql.jdbc.Driver").newInstance();
}
catch (Exception e)
{
System.err.println("Unable to load driver.");
e.printStackTrace();
}
try
{
System.out.println("* Verbindung aufbauen");
String url = "jdbc:mysql://"+hostname+":"+port+"/"+dbname;
conn = DriverManager.getConnection(url, user, password);
System.out.println("* Datenbank-Verbindung beenden");
conn.close();
}
catch (SQLException sqle)
{
System.out.println("SQLException: " + sqle.getMessage());
System.out.println("SQLState: " + sqle.getSQLState());
System.out.println("VendorError: " + sqle.getErrorCode());
sqle.printStackTrace();
}
}
}
init:
deps-jar:
Deleted 5 out of date files in 0 seconds
Compiling 3 source files to C:\Dokumente und Einstellungen\User\Desktop\Marco\Java\ConDB\ConDB\build\classes
Code:
compile:
run:
* Treiber laden
* Treiber laden
Unable to load driver.
java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at DbConnection.connect(DbConnection.java:36)
at Hauptmenue.jButton2ActionPerformed(Hauptmenue.java:106)
at Hauptmenue.access$100(Hauptmenue.java:13)
at Hauptmenue$2.actionPerformed(Hauptmenue.java:56)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
* Verbindung aufbauen
SQLException: No suitable driver found for jdbc:mysql://192.168.*.***:3306/Java01
SQLState: 08001
VendorError: 0
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
java.sql.SQLException: No suitable driver found for jdbc:mysql://192.168.2.235:3306/Java01
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at DbConnection.connect(DbConnection.java:47)
at Hauptmenue.jButton2ActionPerformed(Hauptmenue.java:106)
at Hauptmenue.access$100(Hauptmenue.java:13)
at Hauptmenue$2.actionPerformed(Hauptmenue.java:56)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
BUILD SUCCESSFUL (total time: 1 minute 14 seconds)
ich finde den fehlöer nmich also wieso er keine verbindung aufbaut ja ich weiss fragen über fragen bin aba seeehr dankbar
habe ich ne falsche angabe mit der Quelle des Treibers ?