0

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 ! :)

3
Contributors
5
Replies
19
Views
4 Years
Discussion Span
Last Post by Stefan_1
0

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();
        }
0

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?

0

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...

Edited by Stefan_1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.