G 
		
				
			
		Guest
Gast
		Code:
	
	import java.io.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class mysql extends Frame 
{
		public static void main(String args[])
		{
			Connection con = null;
			Statement st = null;
			ResultSet rs = null;
			TextField tfid;
			TextField tfname;
			TextField tfvorname;
			TextField tfadresse;
			TextField tftelnr;
			
			//Deklarieren der Textflächen
			
			tfid=new TextField();
			tfid.setLocation(5,35);
			tfid.setSize(350,20);
			
			tfname=new TextField();
			tfname.setLocation(5,60);
			tfname.setSize(350,20);
			
			tfvorname=new TextField();
			tfvorname.setLocation(5,85);
			tfvorname.setSize(350,20);
			
			tfadresse=new TextField();
			tfadresse.setLocation(5,105);
			tfadresse.setSize(350,20);
			
			tftelnr=new TextField();
			tftelnr.setLocation(5,130);
			tftelnr.setSize(350,20);
			
			//Deklarieren von MySQL verbindungsvariablen
			
			String user ="root";
			String pw		="";
			String host ="localhost";
			String db		="seite";
			
			String dburl ="jdbc:mysql://127.0.0.1/seite";
			
			//versuch auf die datenbank zu verbinden
			try
			{
				Class.forName("com.mysql.jdbc.Driver").newInstance();
				con = DriverManager.getConnection(dburl,user,pw);
				
				st=con.createStatement();
				String sqlabfrage ="SELECT id,name,vorname,adresse,telnr FROM `table`";
				rs=st.executeQuery(sqlabfrage);
				
				//Schleife um daten in den textflächen auszugeben
				public class grundgeruestawt (String title)
				{
				while(rs.next())
				{
					super (title);
					setLocation(100,100);
					setLayout(new BorderLayout());	
					Color background=new Color(LIGHT_GRAY);
					pack();
					show();
					setBackground(background);
					add(tfid);
				  add(tfname);
				  add(tfvorname);
				  add(tfadresse);
				  add(tftelnr);
					System.out.println(rs.getString(1));
					tfid.setText(rs.getString(1));
					tfname.setText(rs.getString(2));
					tfvorname.setText(rs.getString(3));
					tfadresse.setText(rs.getString(4));
					tftelnr.setText(rs.getString(5));
				}
			}
				
			}
			catch(Exception e)
			{
				System.err.println("Exception: " + e.getMessage());
			}
			finally
			{
				try
				{
					if(rs !=null)rs.close();
					if(st !=null)st.close();
					if(con !=null)con.close();
				}
				catch(SQLException e)
				{
				}
			}
		}
}Es kommen dann folgende Fehlermeldungen:
1. Line 62:illegal start of expression public class grundgeruestawt (String title)
2. Line 62: ; expected public class grundgeruestawt (String title)
3. Line 62: ( expected public class grundgeruestawt (String title)
4. Line 88: "catch" without "try catch(Exception e)
5. Line 51: "try" without "catch" or "finally" try
6. Line 106 ) expected
Für jede Hilfe bin ich dankbar, denn ich finde keinen Fehler.
 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		