Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Beschreiben Sie hier die Klasse datenbank.
- *
- * @author (Ihr Name)
- * @version (eine Versionsnummer oder ein Datum)
- */
- import java.sql.*;
- import java.sql.Statement;
- public class datenbank
- {
- Connection c;
- Statement stat;
- ResultSet r;
- datenbank(){try{
- Class.forName("com.mysql.jdbc.Driver").newInstance();}
- catch(Exception e){
- System.out.println(e);
- }
- try{
- c=DriverManager.getConnection("jdbc:mysql://192.168.1.133/pizza?user=mamapizza&password=1234");
- } catch (Exception e){
- System.out.println(e);}
- try{
- stat=c.createStatement();
- } catch(Exception e){
- System.out.println(e);
- }
- }
- public void Ausgabe(String s, String f, String w)
- {
- String g=new String("select "+s+" from "+f+" where "+w);
- try{
- r=stat.executeQuery(g);
- while (r.next()){
- System.out.println( s+": "+r.getString(s));}}
- catch(Exception e){ System.out.println(e);}
- }
- }
Add Comment
Please, Sign In to add comment