database driver

i have a program with a SQL database developed in JCreator. because I don't want to run it from JCreator, I want a .exe; i created a new .bat file where I wrote this code:

java geStocMain

to launch the application. the application starts, but the problem is that the database can't connect. the java interface works,the buttons, the menus, but I can't open the database. I have to write something in my .bat file? a parameter, a driver connection?

can someone help me please? thank you

[514 byte] By [brezaie_adya] at [2007-11-27 7:48:39]
# 1

> i have a program with a SQL database developed in

> JCreator. because I don't want to run it from

> JCreator, I want a .exe;

what for? Just don't run it from JCreator.

> i created a new .bat file

> where I wrote this code:

> java geStocMain

> to launch the application.

Use an executable JAR, or at least set the -classpath flag.

> the application starts,

> but the problem is that the database can't connect.

Why did you think it was a clever idea to omit the error message from your post?

> the java interface works,the buttons, the menus, but

> I can't open the database. I have to write something

> in my .bat file? a parameter, a driver connection?

Maybe the classpath entry for the driver itself? How can we tell if you don't tel us more about the problem.

CeciNEstPasUnProgrammeura at 2007-7-12 19:29:32 > top of Java-index,Java Essentials,Java Programming...
# 2

all my classes are in the same folder,and I have no problem with them.

the error shown in cmd is:C:\Licenta\GeStocJava>gestocjava.bat

C:\Licenta\GeStocJava>java geStocMain

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClassInternal(Unknown Source)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at ClientiWindow.ReadDataBase(ClientiWindow.java:799)

at ClientiWindow.jbInit(ClientiWindow.java:383)

at ClientiWindow.<init>(ClientiWindow.java:84)

at MainWindow.onClienti(MainWindow.java:162)

at MainWindow.access$000(MainWindow.java:13)

at MainWindow$1.actionPerformed(MainWindow.java:97)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.AbstractButton.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown

Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Eroare incarcare driver!

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/

gestoc

at java.sql.DriverManager.getConnection(Unknown Source)

at java.sql.DriverManager.getConnection(Unknown Source)

at ClientiWindow.ReadDataBase(ClientiWindow.java:806)

at ClientiWindow.jbInit(ClientiWindow.java:383)

at ClientiWindow.<init>(ClientiWindow.java:84)

at MainWindow.onClienti(MainWindow.java:162)

at MainWindow.access$000(MainWindow.java:13)

at MainWindow$1.actionPerformed(MainWindow.java:97)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.AbstractButton.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown

Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

when I push the "Clients" button. you said if I don't want to open it with JCreator,don't open it with that. But with what? I don't want my code to be visible, I want an .exe, so the user can click it und use it without compiling and running it from an editor

brezaie_adya at 2007-7-12 19:29:32 > top of Java-index,Java Essentials,Java Programming...