hello everyone,
can any one tell me following:
1) Is it possible to connect greenfoot game with database.
2) if possible please give me the code.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import data.QuestionNaire; public class dbConnection { Connection connection; String dbName; String tableName; public dbConnection(String dbUrl, String userName, String password, String driver /*, String dbName*/ ) throws Exception { //this.dbName = dbName; System.out.println( "starting connection" ); Class.forName(driver); System.out.println( "driver loaded" ); connection = DriverManager.getConnection(dbUrl, userName, password); } public void finalize() { try { shutdown(); } catch (SQLException se) { se.printStackTrace(); } } } |