# Problem DBVerbindung ausserhalb des Editors:z.B Applet,MSDOS



## Louis2 (19. Jan 2005)

Hallo,

und zwar habe ich folgendes Problem:
Ich habe mir ein Programm geschrieben der sich an einer DB verbindet und Daten in die DB einfügt. Demzufolge habe ich den Oracle Treiber classes12.zip gebraucht.
Den habe ich unter %JAVA_HOME%/jre/lib/ext hinterlegt. Als Eingabe im Java-Editor und wenn ich im MSDOC die .class starte Prog1Tools.zip (IOTools). Als CLASSPATH Variable unter Windows definiert und auch im Editor.
Wenn ich mein Programm im Editor starte, habe ich keine Probleme, läuft super.

Nun habe ich eine .bat Datei herstellt, die erst meine Java Datei kompilieren muss (also javac MassData.java) und dann das Prog. ausführen muss (java MassData). Nach dem eingeben der DB Daten (Username, Password, Server, DBName) beim verbinden zu DB fliegt er raus, MSDOS Fenster schliesst sich sofort.
Habe vor javac... SET CLASSPATH usw... reingeschrieben, nun kann ich keine Eingabe mehr machen, da CLASSPATH Prog1Tools.zip durch classes12.zip ersetzt.

Habe deshalb ein Applet gemacht auf der Html-Seite schreibe ich die Werte ein, klicke auf "Connect", nichts passiert, nur Fehlermeldung "Driver not Found".
Dann ein .bat Datei herstellt drinne SET CLASSPATH...classes12.zip dann meine html-Seite gestartet, in der drin steht, dass er die .class datei natürlich starten muss. Selbes Problem, nichts passiert ausser Fehlermeldung.

Woran liegt es, wie kann ich es beheben? Im Editor läuft es ja ohne Probleme. Thx.


```
import java.awt.*;  
import java.applet.*; 
import java.awt.event.*; 
import java.sql.*;

public class MassData_GraficGUI extends Applet 
{    
    private Label dbm_userq, passwordq, database_serverq, database_nameq, question, numbercustomerq, numberaddressq, numbercontactpq, numbercontactnq, numberactivityq, numbertroubleticketq, numberactivityqh, numbertroubleticketqh, ausnahment, numberlieferantq, numberinteressentq,title;  
    private Button b1;  
    private TextField dbm_user, password, database_server, database_name, numbercustomer, numberaddress, numbercontactp, numbercontactn, numberactivity, numbertroubleticket, numberactivityh, numbertroubleticketh, ausnahmen, numberlieferant, numberinteressent;
    private CheckboxGroup cbg1;   
    private Checkbox typ, max;  
    private Abhoerer abh; 
         
    public void init()
    {
    	setLayout(null);
            
        title = new Label("MassData Tool / Version 1.0");
    	title.setBounds(20, 10, 175, 20); 
    	add(title);
        
    	dbm_userq = new Label("DB-Username:");
    	dbm_userq.setBounds(20, 40, 100, 20); 
    	add(dbm_userq);
    	dbm_user = new TextField();
    	dbm_user.setBounds(125, 40, 100, 20);
        add(dbm_user);
        
        passwordq = new Label("DB-Password:");
    	passwordq.setBounds(20, 70, 100, 20); 
    	add(passwordq);
    	password = new TextField();
    	password.setBounds(125, 70, 100, 20);
    	add(password);
        
        database_serverq = new Label("DB-Server:");
    	database_serverq.setBounds(20, 100, 100, 20); 
    	add(database_serverq);
    	database_server = new TextField();
    	database_server.setBounds(125, 100, 100, 20);
    	add(database_server);
        
        database_nameq = new Label("DB-Name:");
    	database_nameq.setBounds(20, 130, 100, 20); 
    	add(database_nameq);
    	database_name = new TextField();
    	database_name.setBounds(125, 130, 100, 20);
    	add(database_name);
    
        question = new Label("Welche Felder sollen in der DB gefüllt werden:");
    	question.setBounds(20, 190, 275, 20); 
    	add(question);
        cbg1 = new CheckboxGroup();   
    	typ = new Checkbox("Typische Felder", cbg1, true);    
    	max = new Checkbox("Max. Felder", cbg1, false);   
       	typ.setBounds(300, 180, 125, 20);
    	add(typ); 
    	max.setBounds(300, 200, 125, 20);
    	add(max); 
    	    	
    	numbercustomerq = new Label("Anzahl der Kunden die in der DB angelegt werden sollen:");
    	numbercustomerq.setBounds(20, 260, 450, 20); 
    	add(numbercustomerq);
    	numbercustomer = new TextField();
    	numbercustomer.setBounds(475, 260, 75, 20);
    	add(numbercustomer);
        
        numberlieferantq = new Label("Anzahl der Lieferanten die in der DB angelegt werden sollen:");
    	numberlieferantq.setBounds(20, 290, 450, 20); 
    	add(numberlieferantq);
    	numberlieferant = new TextField();
    	numberlieferant.setBounds(475, 290, 75, 20);
    	add(numberlieferant);
        
        numberinteressentq = new Label("Anzahl der Interessenten die in der DB angelegt werden sollen:");
    	numberinteressentq.setBounds(20, 320, 450, 20); 
    	add(numberinteressentq);
    	numberinteressent = new TextField();
    	numberinteressent.setBounds(475, 320, 75, 20);
    	add(numberinteressent);
        
        numberaddressq = new Label("Anzahl der Adressen die in jede Firma angelegt werden sollen:");
    	numberaddressq.setBounds(20, 350, 450, 20); 
    	add(numberaddressq);
    	numberaddress = new TextField();
    	numberaddress.setBounds(475, 350, 75, 20);
    	add(numberaddress);
        
        numbercontactpq = new Label("Anzahl der Kontaktpersonen die in jeder Adresse angelegt werden sollen:");
    	numbercontactpq.setBounds(20, 380, 450, 20); 
    	add(numbercontactpq);
    	numbercontactp = new TextField();
    	numbercontactp.setBounds(475, 380, 75, 20);
    	add(numbercontactp);
        
        numbercontactnq = new Label("Anzahl der Kontaktnummern die in jeder Kontaktperson angelegt werden sollen:");
    	numbercontactnq.setBounds(20, 410, 450, 20); 
    	add(numbercontactnq);
    	numbercontactn = new TextField();
    	numbercontactn.setBounds(475, 410, 75, 20);
    	add(numbercontactn);
        
        numberactivityqh = new Label("Anzahl der hist. Aktivitäten die für jede Adresse angelegt werden sollen:");
    	numberactivityqh.setBounds(20, 440, 450, 20); 
    	add(numberactivityqh);
    	numberactivityh = new TextField();
    	numberactivityh.setBounds(475, 440, 75, 20);
    	add(numberactivityh);
        
        numberactivityq = new Label("Anzahl der Aktivitäten die für jede Adresse angelegt werden sollen:");
    	numberactivityq.setBounds(20, 470, 450, 20); 
    	add(numberactivityq);
    	numberactivity = new TextField();
    	numberactivity.setBounds(475, 470, 75, 20);
    	add(numberactivity);
        
        numbertroubleticketqh = new Label("Anzahl der hist. Problemfälle die für jede Adresse angelegt werden sollen:");
    	numbertroubleticketqh.setBounds(20, 500, 450, 20); 
    	add(numbertroubleticketqh);
    	numbertroubleticketh = new TextField();
    	numbertroubleticketh.setBounds(475, 500, 75, 20);
    	add(numbertroubleticketh);
        
        numbertroubleticketq = new Label("Anzahl der Problemfälle die für jede Adresse angelegt werden sollen:");
    	numbertroubleticketq.setBounds(20, 530, 450, 20); 
    	add(numbertroubleticketq);
    	numbertroubleticket = new TextField();
    	numbertroubleticket.setBounds(475, 530, 75, 20);
    	add(numbertroubleticket);
    	
        abh = new Abhoerer();
    	b1 = new Button("Connect/Job");  
        b1.setBounds(20, 590, 100, 20);
        add(b1);
 	b1.addActionListener(abh);  
 		
 	ausnahment = new Label("Notice:");
    	ausnahment.setBounds(175, 590, 50, 20); 
    	add(ausnahment);
    	ausnahmen = new TextField();
    	ausnahmen.setBounds(225, 590, 500, 75);
    	add(ausnahmen);
    }
        class Abhoerer implements ActionListener
 	{
            public void actionPerformed(ActionEvent e)  
            {  
                try 
                { 
                    String du = String.valueOf(dbm_user.getText()); 
                    String p = String.valueOf(password.getText()); 
                    String ds = String.valueOf(database_server.getText()); 
                    String dn = String.valueOf(database_name.getText()); 
                    
                    Class.forName("oracle.jdbc.driver.OracleDriver"); 
                    String url = "jdbc:oracle:thin:@"+ds+":1521:"+dn; 
                    Connection connection = DriverManager.getConnection(url, du, p);
                    
                    String resultcompany=new String();
                    String resultlieferant=new String();
                    String resultinteressent=new String();
                    String resultaddress=new String();
                    String resultcontactp=new String();
                    String resultcontactn=new String();
                    String resulthistactivity=new String();
                    String resultactivity=new String();
                    String resulthisttroubleticket=new String();
                    String resulttroubleticket=new String();
                
                    int customerno=0;
                    int customerid=0;
                    int addressid=0;
                    int addressno=0;
                    int contactpid=0;
                    int contactnid=0;
                    int activityid=0;
                    int troubleticketid=0;
                    int i,j,k,l,m,n,o,s,q,r;
                    
                    int nc = Integer.valueOf(numbercustomer.getText()).intValue(); 
                    int nl = Integer.valueOf(numberlieferant.getText()).intValue(); 
                    int ni = Integer.valueOf(numberinteressent.getText()).intValue(); 
                    int na = Integer.valueOf(numberaddress.getText()).intValue(); 
                    int ncp = Integer.valueOf(numbercontactp.getText()).intValue(); 
                    int ncn = Integer.valueOf(numbercontactn.getText()).intValue(); 
                    int nth = Integer.valueOf(numbertroubleticketh.getText()).intValue(); 
                    int nt = Integer.valueOf(numbertroubleticket.getText()).intValue(); 
                    int nach = Integer.valueOf(numberactivityh.getText()).intValue(); 
                    int nac = Integer.valueOf(numberactivity.getText()).intValue(); 
                    
                    if (cbg1.getSelectedCheckbox().getLabel()=="Typische Felder") 
                    {
                        for (i=1; i<=nc; i++)
                        {
                            Statement company = connection.createStatement(); 
                            resultcompany = "INSERT into customer (customerno,customerid,mandator,companyname,shorttext,customerclass,searchname) values (" + (customerno=customerno+1) + "," + (customerid=customerid+1) + ",'DEMO'" + ",'Testcustomer','Testcustomer','K','Testcustomer')"; 
                            company.executeUpdate(resultcompany); 
                            connection.commit(); 
                            for (j=1; j<=na; j++)
                            {
                                Statement address= connection.createStatement();
                                resultaddress = "INSERT into address (addressno,addressid,customerid,name1,street,streetnumber,zip,city,countrycode,addresstype,searchname) values (" + (addressno=addressno+1) + "," + (addressid=addressid+1) + "," + customerid + ",'Testaddress','Teststreet',23,76131,'Testcity','D',1,'Testaddress')";
                                address.executeUpdate(resultaddress); 
                                connection.commit(); 
                                for (s=1; s<=nth; s++)
                                {
                                    Statement histtroubleticket= connection.createStatement();
                                    resulthisttroubleticket = "INSERT into troubletickethist (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                    histtroubleticket.executeUpdate(resulthisttroubleticket); 
                                    connection.commit();
                                    histtroubleticket.close();
                                }
                                for (n=1; n<=nt; n++)
                                {
                                    Statement troubleticket= connection.createStatement();
                                    resulttroubleticket = "INSERT into troubleticket (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                    troubleticket.executeUpdate(resulttroubleticket); 
                                    connection.commit();
                                    troubleticket.close();
                                }
                                for (o=1; o<=nach; o++)
                                {
                                    Statement histactivity= connection.createStatement();
                                    resulthistactivity = "INSERT into activityhist (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                    histactivity.executeUpdate(resulthistactivity); 
                                    connection.commit();
                                    histactivity.close();
                                }
                                for (m=1; m<=nac; m++)
                                {       
                                    Statement activity= connection.createStatement();
                                    resultactivity = "INSERT into activity (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                    activity.executeUpdate(resultactivity); 
                                    connection.commit();
                                    activity.close();
                                }
                                for (k=1; k<=ncp; k++)
                                {
                                    Statement contactp= connection.createStatement();
                                    resultcontactp = "INSERT into contactperson (contactpersonid,addressid,greetingcode,firstname,lastname) values (" + (contactpid=contactpid+1) + "," + addressid + ",'MR','Testman','Testman')";
                                    contactp.executeUpdate(resultcontactp); 
                                    connection.commit(); 
                                    for (l=1; l<=ncn; l++)
                                    {
                                        Statement contactn= connection.createStatement();
                                        resultcontactn = "INSERT into contactnumber (contactnumberid,contactpersonid,addressid,mandator,contactnumbertype,contactnumber) values (" + (contactnid=contactnid+1) + "," + contactpid + "," + addressid + ",'DEMO',1,2222)";
                                        contactn.executeUpdate(resultcontactn); 
                                        connection.commit(); 
                                        contactn.close();
                                    }
                                    contactp.close();
                                }
                                address.close();
                            }
                            company.close();
                        }
                        for (q=1; q<=nl; q++)
                        {
                            Statement lieferant = connection.createStatement(); 
                            resultlieferant = "INSERT into customer (customerno,customerid,mandator,companyname,shorttext,customerclass,searchname) values (" + (customerno=customerno+1) + "," + (customerid=customerid+1) + ",'DEMO'" + ",'Testcustomer','Testcustomer','L','Testcustomer')"; 
                            lieferant.executeUpdate(resultlieferant); 
                            connection.commit();
                            for (j=1; j<=na; j++)
                            {
                                Statement address= connection.createStatement();
                                resultaddress = "INSERT into address (addressno,addressid,customerid,name1,street,streetnumber,zip,city,countrycode,addresstype,searchname) values (" + (addressno=addressno+1) + "," + (addressid=addressid+1) + "," + customerid + ",'Testaddress','Teststreet',23,76131,'Testcity','D',1,'Testaddress')";
                                address.executeUpdate(resultaddress); 
                                connection.commit(); 
                                for (s=1; s<=nth; s++)
                                {
                                    Statement histtroubleticket= connection.createStatement();
                                    resulthisttroubleticket = "INSERT into troubletickethist (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                    histtroubleticket.executeUpdate(resulthisttroubleticket); 
                                    connection.commit();
                                    histtroubleticket.close();
                                }
                                for (n=1; n<=nt; n++)
                                {
                                    Statement troubleticket= connection.createStatement();
                                    resulttroubleticket = "INSERT into troubleticket (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                    troubleticket.executeUpdate(resulttroubleticket); 
                                    connection.commit();
                                    troubleticket.close();
                                }
                                for (o=1; o<=nach; o++)
                                {
                                    Statement histactivity= connection.createStatement();
                                    resulthistactivity = "INSERT into activityhist (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                    histactivity.executeUpdate(resulthistactivity); 
                                    connection.commit();
                                    histactivity.close();
                                }
                                for (m=1; m<=nac; m++)
                                {       
                                    Statement activity= connection.createStatement();
                                    resultactivity = "INSERT into activity (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                    activity.executeUpdate(resultactivity); 
                                    connection.commit();
                                    activity.close();
                                }
                                for (k=1; k<=ncp; k++)
                                {
                                    Statement contactp= connection.createStatement();
                                    resultcontactp = "INSERT into contactperson (contactpersonid,addressid,greetingcode,firstname,lastname) values (" + (contactpid=contactpid+1) + "," + addressid + ",'MR','Testman','Testman')";
                                    contactp.executeUpdate(resultcontactp); 
                                    connection.commit(); 
                                    for (l=1; l<=ncn; l++)
                                    {
                                        Statement contactn= connection.createStatement();
                                        resultcontactn = "INSERT into contactnumber (contactnumberid,contactpersonid,addressid,mandator,contactnumbertype,contactnumber) values (" + (contactnid=contactnid+1) + "," + contactpid + "," + addressid + ",'DEMO',1,2222)";
                                        contactn.executeUpdate(resultcontactn); 
                                        connection.commit(); 
                                        contactn.close();
                                        }
                                    contactp.close();
                                    }
                                address.close();
                                }
                            lieferant.close();
                            }    
                        for (r=1; r<=ni; r++)
                        {   
                            Statement interessent = connection.createStatement(); 
                            resultinteressent = "INSERT into customer (customerno,customerid,mandator,companyname,shorttext,customerclass,searchname) values (" + (customerno=customerno+1) + "," + (customerid=customerid+1) + ",'DEMO'" + ",'Testcustomer','Testcustomer','I','Testcustomer')"; 
                            interessent.executeUpdate(resultinteressent); 
                            connection.commit();
                            for (j=1; j<=na; j++)
                            {
                                Statement address= connection.createStatement();
                                resultaddress = "INSERT into address (addressno,addressid,customerid,name1,street,streetnumber,zip,city,countrycode,addresstype,searchname) values (" + (addressno=addressno+1) + "," + (addressid=addressid+1) + "," + customerid + ",'Testaddress','Teststreet',23,76131,'Testcity','D',1,'Testaddress')";
                                address.executeUpdate(resultaddress); 
                                connection.commit(); 
                                for (s=1; s<=nth; s++)
                                {
                                    Statement histtroubleticket= connection.createStatement();
                                    resulthisttroubleticket = "INSERT into troubletickethist (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                    histtroubleticket.executeUpdate(resulthisttroubleticket); 
                                    connection.commit();
                                    histtroubleticket.close();
                                }
                                for (n=1; n<=nt; n++)
                                {
                                    Statement troubleticket= connection.createStatement();
                                    resulttroubleticket = "INSERT into troubleticket (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                    troubleticket.executeUpdate(resulttroubleticket); 
                                    connection.commit();
                                    troubleticket.close();
                                }
                                for (o=1; o<=nach; o++)
                                {
                                    Statement histactivity= connection.createStatement();
                                    resulthistactivity = "INSERT into activityhist (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                    histactivity.executeUpdate(resulthistactivity); 
                                    connection.commit();
                                    histactivity.close();
                                }
                                for (m=1; m<=nac; m++)
                                {       
                                    Statement activity= connection.createStatement();
                                    resultactivity = "INSERT into activity (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                    activity.executeUpdate(resultactivity); 
                                    connection.commit();
                                    activity.close();
                                }
                                for (k=1; k<=ncp; k++)
                                {
                                    Statement contactp= connection.createStatement();
                                    resultcontactp = "INSERT into contactperson (contactpersonid,addressid,greetingcode,firstname,lastname) values (" + (contactpid=contactpid+1) + "," + addressid + ",'MR','Testman','Testman')";
                                    contactp.executeUpdate(resultcontactp); 
                                    connection.commit(); 
                                    for (l=1; l<=ncn; l++)
                                    {
                                        Statement contactn= connection.createStatement();
                                        resultcontactn = "INSERT into contactnumber (contactnumberid,contactpersonid,addressid,mandator,contactnumbertype,contactnumber) values (" + (contactnid=contactnid+1) + "," + contactpid + "," + addressid + ",'DEMO',1,2222)";
                                        contactn.executeUpdate(resultcontactn); 
                                        connection.commit(); 
                                        contactn.close();
                                    }
                                    contactp.close();
                                }
                            address.close();
                            }
                        interessent.close();
                        }
                    }
                                                               
                else
                {
                    for (i=1; i<=nc; i++)
                    {
                        Statement company = connection.createStatement(); 
                        resultcompany = "INSERT into customer (customerno,customerid,mandator,companyname,shorttext,customerclass,searchname) values (" + i + "," + (customerid=customerid+1) + ",'DEMO'" + ",'Testcustomer','Testcustomer','K','Testcustomer')";  
                        company.executeUpdate(resultcompany); 
                        connection.commit(); 
                        for (j=1; j<=na; j++)
                        {
                            Statement address= connection.createStatement();
                            resultaddress = "INSERT into address (addressno,addressid,customerid,name1,name2,name3,street,streetnumber,zip,city,countrycode,region,pobox,zip_pobox,addresstype,language,searchname) values (" + (addressno=addressno+1) + "," + (addressid=addressid+1) + "," + customerid + ",'Testaddress','Testaddress','Testaddress','Teststreet',23,76131,'Testcity','D','BW',1973,66801,1,'de','Testaddress')";
                            address.executeUpdate(resultaddress); 
                            connection.commit(); 
                            for (s=1; s<=nth; s++)
                            {
                                Statement histtroubleticket= connection.createStatement();
                                resulthisttroubleticket = "INSERT into troubletickethist (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                histtroubleticket.executeUpdate(resulthisttroubleticket); 
                                connection.commit();
                                histtroubleticket.close();
                            }
                            for (n=1; n<=nt; n++)
                            {
                                Statement troubleticket= connection.createStatement();
                                resulttroubleticket = "INSERT into troubleticket (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                troubleticket.executeUpdate(resulttroubleticket); 
                                connection.commit();
                                troubleticket.close();
                            }
                            for (o=1; o<=nach; o++)
                            {
                                Statement histactivity= connection.createStatement();
                                resulthistactivity = "INSERT into activityhist (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                histactivity.executeUpdate(resulthistactivity); 
                                connection.commit();
                                histactivity.close();
                            }
                            for (m=1; m<=nac; m++)
                            {       
                                Statement activity= connection.createStatement();
                                resultactivity = "INSERT into activity (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                activity.executeUpdate(resultactivity); 
                                connection.commit();
                                activity.close();
                            }
                            for (k=1; k<=ncp; k++)
                            {
                                    Statement contactp= connection.createStatement();
                                    resultcontactp = "INSERT into contactperson (contactpersonid,addressid,greetingcode,firstname,lastname,language,title) values (" + (contactpid=contactpid+1) + "," + addressid + ",'MR','Testman','Testman','de','Dr')";
                                    contactp.executeUpdate(resultcontactp); 
                                    connection.commit(); 
                                    for (l=1; l<=ncn; l++)
                                    {
                                        Statement contactn= connection.createStatement();
                                        resultcontactn = "INSERT into contactnumber (contactnumberid,contactpersonid,addressid,mandator,contactnumbertype,contactnumber) values (" + (contactnid=contactnid+1) + "," + contactpid + "," + addressid + ",'DEMO',1,2222)";
                                        contactn.executeUpdate(resultcontactn); 
                                        connection.commit(); 
                                        contactn.close();
                                    }
                                    contactp.close();
                            }
                            address.close();
                        }
                        company.close();
                    }
                    for (i=1; i<=nl; i++)
                    {
                        Statement lieferant = connection.createStatement(); 
                        resultlieferant = "INSERT into customer (customerno,customerid,mandator,companyname,shorttext,customerclass,searchname) values (" + i + "," + (customerid=customerid+1) + ",'DEMO'" + ",'Testcustomer','Testcustomer','L','Testcustomer')";  
                        lieferant.executeUpdate(resultlieferant); 
                        connection.commit(); 
                        for (j=1; j<=na; j++)
                        {
                            Statement address= connection.createStatement();
                            resultaddress = "INSERT into address (addressno,addressid,customerid,name1,name2,name3,street,streetnumber,zip,city,countrycode,region,pobox,zip_pobox,addresstype,language,searchname) values (" + (addressno=addressno+1) + "," + (addressid=addressid+1) + "," + customerid + ",'Testaddress','Testaddress','Testaddress','Teststreet',23,76131,'Testcity','D','BW',1973,66801,1,'de','Testaddress')";
                            address.executeUpdate(resultaddress); 
                            connection.commit(); 
                            for (s=1; s<=nth; s++)
                            {
                                Statement histtroubleticket= connection.createStatement();
                                resulthisttroubleticket = "INSERT into troubletickethist (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                histtroubleticket.executeUpdate(resulthisttroubleticket); 
                                connection.commit();
                                histtroubleticket.close();
                            }
                            for (n=1; n<=nt; n++)
                            {
                                Statement troubleticket= connection.createStatement();
                                resulttroubleticket = "INSERT into troubleticket (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                troubleticket.executeUpdate(resulttroubleticket); 
                                connection.commit();
                                troubleticket.close();
                            }
                            for (o=1; o<=nach; o++)
                            {
                                Statement histactivity= connection.createStatement();
                                resulthistactivity = "INSERT into activityhist (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                histactivity.executeUpdate(resulthistactivity); 
                                connection.commit();
                                histactivity.close();
                            }
                            for (m=1; m<=nac; m++)
                            {       
                                Statement activity= connection.createStatement();
                                resultactivity = "INSERT into activity (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                activity.executeUpdate(resultactivity); 
                                connection.commit();
                                activity.close();
                            }
                            for (k=1; k<=ncp; k++)
                            {
                                    Statement contactp= connection.createStatement();
                                    resultcontactp = "INSERT into contactperson (contactpersonid,addressid,greetingcode,firstname,lastname,language,title) values (" + (contactpid=contactpid+1) + "," + addressid + ",'MR','Testman','Testman','de','Dr')";
                                    contactp.executeUpdate(resultcontactp); 
                                    connection.commit(); 
                                    for (l=1; l<=ncn; l++)
                                    {
                                        Statement contactn= connection.createStatement();
                                        resultcontactn = "INSERT into contactnumber (contactnumberid,contactpersonid,addressid,mandator,contactnumbertype,contactnumber) values (" + (contactnid=contactnid+1) + "," + contactpid + "," + addressid + ",'DEMO',1,2222)";
                                        contactn.executeUpdate(resultcontactn); 
                                        connection.commit(); 
                                        contactn.close();
                                    }
                                    contactp.close();
                            }
                            address.close();
                        }
                        lieferant.close();
                    }
                    for (i=1; i<=ni; i++)
                    {
                        Statement interessent = connection.createStatement(); 
                        resultinteressent = "INSERT into customer (customerno,customerid,mandator,companyname,shorttext,customerclass,searchname) values (" + i + "," + (customerid=customerid+1) + ",'DEMO'" + ",'Testcustomer','Testcustomer','I','Testcustomer')";  
                        interessent.executeUpdate(resultinteressent); 
                        connection.commit(); 
                        for (j=1; j<=na; j++)
                        {
                            Statement address= connection.createStatement();
                            resultaddress = "INSERT into address (addressno,addressid,customerid,name1,name2,name3,street,streetnumber,zip,city,countrycode,region,pobox,zip_pobox,addresstype,language,searchname) values (" + (addressno=addressno+1) + "," + (addressid=addressid+1) + "," + customerid + ",'Testaddress','Testaddress','Testaddress','Teststreet',23,76131,'Testcity','D','BW',1973,66801,1,'de','Testaddress')";
                            address.executeUpdate(resultaddress); 
                            connection.commit(); 
                            for (s=1; s<=nth; s++)
                            {
                                Statement histtroubleticket= connection.createStatement();
                                resulthisttroubleticket = "INSERT into troubletickethist (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                histtroubleticket.executeUpdate(resulthisttroubleticket); 
                                connection.commit();
                                histtroubleticket.close();
                            }
                            for (n=1; n<=nt; n++)
                            {
                                Statement troubleticket= connection.createStatement();
                                resulttroubleticket = "INSERT into troubleticket (troubleticketid,customerid,addressid,employeeid,mandator,description,troubleticketstate,term1,term2) values (" + (troubleticketid=troubleticketid+1) + "," + customerid + "," + addressid + ",1,'DEMO','TestSupportCall','AUFG','31.12.2004','31.12.2005')";
                                troubleticket.executeUpdate(resulttroubleticket); 
                                connection.commit();
                                troubleticket.close();
                            }
                            for (o=1; o<=nach; o++)
                            {
                                Statement histactivity= connection.createStatement();
                                resulthistactivity = "INSERT into activityhist (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                histactivity.executeUpdate(resulthistactivity); 
                                connection.commit();
                                histactivity.close();
                            }
                            for (m=1; m<=nac; m++)
                            {       
                                Statement activity= connection.createStatement();
                                resultactivity = "INSERT into activity (activityid,customerid,addressid,employeeid,mandator,subject,state,activitytype,activitypriority,term,deadline) values (" + (activityid=activityid+1) + "," + customerid + "," + addressid + ",1,'DEMO','Testactivity','NB','ANG',1,'31.12.2004','31.12.2005')";
                                activity.executeUpdate(resultactivity); 
                                connection.commit();
                                activity.close();
                            }
                            for (k=1; k<=ncp; k++)
                            {
                                    Statement contactp= connection.createStatement();
                                    resultcontactp = "INSERT into contactperson (contactpersonid,addressid,greetingcode,firstname,lastname,language,title) values (" + (contactpid=contactpid+1) + "," + addressid + ",'MR','Testman','Testman','de','Dr')";
                                    contactp.executeUpdate(resultcontactp); 
                                    connection.commit(); 
                                    for (l=1; l<=ncn; l++)
                                    {
                                        Statement contactn= connection.createStatement();
                                        resultcontactn = "INSERT into contactnumber (contactnumberid,contactpersonid,addressid,mandator,contactnumbertype,contactnumber) values (" + (contactnid=contactnid+1) + "," + contactpid + "," + addressid + ",'DEMO',1,2222)";
                                        contactn.executeUpdate(resultcontactn); 
                                        connection.commit(); 
                                        contactn.close();
                                    }
                                    contactp.close();
                            }
                            address.close();
                        }
                        interessent.close();
                    }
                }
                ausnahmen.setText("!!!!!Please execute the Userrights Batchrun!!!!!"); 
                connection.close();
                } 
                
                catch(ClassNotFoundException e1) 
                { 
                    ausnahmen.setText("Driver not found"); 
                    e1.printStackTrace(); 
                } 
                catch(SQLException e2) 
                { 
                    ausnahmen.setText(e2.toString()); 
                } 
                catch(Exception e3) 
                {    
                    e3.printStackTrace(); 
                } 
                
            }
        }
}
```

Gruß


----------



## Louis2 (19. Jan 2005)

Diese Meldung bringt er in MSDOS z.b raus

```
Driver not found
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
        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 MassData.main(MassData.java:19)
```

Wie kann ich eingeben, dass er den Treiber classes12.zip benutzen soll? Nur über SET CLASSPATH?


----------



## foobar (19. Jan 2005)

Benutz doch mal die Suche das wurde schon soooooooooooo oft gefragt.


----------



## Louis2 (19. Jan 2005)

@footbar: Das Problem ist etwas anders. Ich brauche als CLASSPATH sowohl Prog1Tools.zip als auch classes12.zip, aber als Systemvariablen kann man nur ein Pfad eingeben oder doch mehrere (getrennt durch was?)? Wenn man auf jeden Fall mehrere CLASSPATH angibt, wird (das)? alte überschrieben. :wink:

Ach ja, wo soll ich am besten meine  

```
public static void main(String[] args) 
{
...
}
```

reinstellen??? ???:L


----------



## Bleiglanz (19. Jan 2005)

Wenn man auf jeden Fall mehrere CLASSPATH angibt, wird (das)? alte überschrieben. 
???????????


java -cp ordner1;ordner2;ein.jar;nocheins MeineKlasse


da wird gar nix "überschrieben"?

und vergiss die Umgebungsvariable "CLASSPATH"

und lösch alles was du reingetan hast aus $JRE/lib/ext wieder raus


----------

