Hello i need to save score on application close and when will start up to show the last score is entered... i have not idea how do i start i have searched on google but nothing found which can help me, please show me some ways/codes of doing it.
Thanks ! :)

Recommended Answers

All 5 Replies

Actualy the score is taken from mysql database and all i want to make is to read the score on application start up, im sorry i forgot to write this..

I have this code but it doesnt work application is crashing or not showing the results...

try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = DriverManager.getConnection("jdbc:mysql://DATABASE", "USERNAME", "PASSWORD");
            Statement stmt = conn.createStatement();
            ResultSet rset = stmt.executeQuery("select * from BackgammonResults");
            while (rset.next()) {
                asd = rset.getInt("Stefan"); // local variable
                asd1 = rset.getInt("Bojan"); // local variable

            }
            stefanRes.setText(asd);
            bojanRes.setText(asd1);
        } catch (Exception e) {
            e.printStackTrace();
        }

I'm not a huge fan of connecting a user-end application to a remote database like that. I would suggest making a TCP server that does the database access for you.

What does the error look like?

Theres much error lines i cannot copy and paste it all that.. but the first line is: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver but i have the MySQL-Connector...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.