H2 Database suddenly disappeared?

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

H2 Database suddenly disappeared?

Postby rjgtav » 29 Jun 2010, 10:23

Hello. I always used the url jdbc:h2:~/test to access my game's. Today i started my Smartfox Server Pro as usually and it didn't give any problems. minutes ago, i needed to restart my server. When it restarted, it gave the following error:

Code: Select all

11:37:56.568 - [ SEVERE ] > DbManager could not retrive a connection. org.h2.jdbcSQLException: General error: java.lang.Error: rowcount remaining=-1 SYS [HY000-60}
it.gotoandplay.smartfoxserver.exceptions.DbManagerException: The Test SQL statement failed! Please check your configuration.
at it.gotoandplay.smartfoxserver.SmartFoxServer.setupZone(SmartFoxServer.java:1843
(...)


I don't know why is this happening, because i didn't change anything in the server. Only in the client and what i changed was only design, not script.

here's my config:

Code: Select all

<Zone name="FPS" uCountUpdate="true" maxUsers="10000" customLogin="false" roomListVars="true">
         <AutoReloadExtensions>true</AutoReloadExtensions>

         <BuddyList active="true">
            <size>200</size>
            <maxBuddyVariables>10</maxBuddyVariables>
            <mode>advanced</mode>
            
            <!-- Apply only for advanced mode -->
            <offLineBuddyVariables>true</offLineBuddyVariables>
            <permissionTimeOut>10</permissionTimeOut>
            <mutualAddBuddy>true</mutualAddBuddy>
            <mutualRemoveBuddy>true</mutualRemoveBuddy>
         </BuddyList>   

         <Rooms>
            <Room name="Lobby" maxUsers="5000" isPrivate="false" isTemp="false" autoJoin="false" uCountUpdate="true"/>
            <Room name="Login" maxUsers="5000" isPrivate="false" isTemp="false" autoJoin="true" uCountUpdate="false" />
         </Rooms>

         <DatabaseManager active="true">

            <Driver>sun.jdbc.odbc.JdbcOdbcDriver</Driver>
            <ConnectionString>jdbc:h2:~/test</ConnectionString>
   
            <!-- If you use MySQL, the connections string becomes...
            <Driver>org.gjt.mm.mysql.Driver</Driver>
            <ConnectionString>jdbc:mysql://127.0.0.1:3306/sfsTest</ConnectionString>
            -->
         
            <UserName>sa</UserName>
            <Password></Password>
         
         
            <TestSQL><![CDATA[SELECT COUNT(*) FROM users]]></TestSQL>
         
         
            <MaxActive>100</MaxActive>
            <MaxIdle>100</MaxIdle>
         
         
            <OnExhaustedPool>fail</OnExhaustedPool>
            <BlockTime>5000</BlockTime>
         
         </DatabaseManager>
         
         <Extensions>
            <extension name="FPSextension"  className="FPSextension.as" type="script" />
         </Extensions>
         
         <Moderators status="on">
            <Mod name="modname" pwd="pwd" />
         </Moderators>
      </Zone>


Then i tried to access the database with h2 database manager ad it gave the following error:

Code: Select all

General error: java.lang.Error: rowcount remaining=-1 SYS [HY000-60]


Please help me.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 30 Jun 2010, 08:08

Please! This is urgent! I've already solved it by creating another database, but i want to know how to solve the next time it happens...
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 03 Jul 2010, 11:12

Lapo, please help me...
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 05 Jul 2010, 17:03

Your DBManager config seems wrong.
The example Zone we provide and that uses H2 hasthese settings:

Code: Select all

<DatabaseManager active="false">
   <Driver>org.h2.Driver</Driver>
   <ConnectionString>jdbc:h2:tcp://localhost:9009/examples</ConnectionString>
   
   <UserName>sa</UserName>
   <Password></Password>
   
   <TestSQL><![CDATA[SELECT COUNT(*) FROM retrocomputers]]></TestSQL>
   
   <MaxActive>10</MaxActive>
   <MaxIdle>10</MaxIdle>
   
   <OnExhaustedPool>fail</OnExhaustedPool>
   <BlockTime>5000</BlockTime>
</DatabaseManager>


You are using the wrong driver and the connection string doesn't look good too.
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 08 Jul 2010, 09:04

But it worked for months. To solve temporarily my problem i only changed the "/examples" to another location.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 12 Jul 2010, 15:19

Do you have any clue what is the problem?
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 12 Jul 2010, 16:14

Unfortunately no, I don't have enough info to understand what's going on plus the your last message made me even more confused.
My guess is that probably you have inadvertently moved/removed files that are related with the db?
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 13 Jul 2010, 09:04

No. I didn't change any file in my system. one day it was working. the next day when i started my computer, it dissapeared
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 11 Aug 2010, 18:30

Hi there. I don't know why, but it happened again! Once again, one hour ago, it was working, but now, it isn't anymore. It gives again error while starting the server because the Sql test failed because it couldn't find the database. And if I try to connect to the database with the adminDb, it gives the error that couldn't connect because the row count is -1. Please help solving my problem. Because i don't want to my database be deleted when i'll put my game online.
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 12 Aug 2010, 07:18

You could try recovering your (possibly corrupted) h2 database by adding ;Recover=1 at the end of your URL connection string @ dbAdmin login page.

i.e. jdbc:h2:tcp://localhost:9009/example;RECOVER=1
Smartfox's forum is my daily newspaper.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 12 Aug 2010, 12:34

Thanks for your reply. It worked :-). I have my database back! Do you know why this happens?

--EDIT--

Well, i can connect to the database with the Recover=1.
But the sfs can't still connect to it without the Recover=1. Do i need to add Recover=1 in the config.xml too?

--EDIT 2--

I added Recover=1 in the config.xml. It connects to my database. But now is the database RETROCOMPUTERS from your example that is corrupted. Could you explain why is this happening?
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 12 Aug 2010, 13:29

What is happening is really difficult to say, without knowing what's going on your machine, how your are using the DB etc...

I can assure you that under normal conditions we have never seen anything like this happening. The H2 database engine is very stable and unlikely to create any sort of problems.

Data corruption can happen for dozens of reasons including problems in your HD, misuse of the software and whatnot.

If you still have problems I would highly recommend to start over with a clean SFS installation.
Lapo

--

gotoAndPlay()

...addicted to flash games
TiagoR
Posts: 83
Joined: 15 Mar 2010, 11:42
Location: Portugal
Contact:

Postby TiagoR » 12 Aug 2010, 14:30

If you're in windows check if you dont have 'frozen' Java processes in windows task manager.
TR
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 12 Aug 2010, 16:27

Thanks for the help.

If you still have problems I would highly recommend to start over with a clean SFS installation.


This is a new pc. I intalled sfs in this pc a couple months ago. And i don't think that's a hd problem. I'll try installing sfs again and this time, i'll disable all the zones except mine.

If you're in windows check if you dont have 'frozen' Java processes in windows task manager.


There is no frozen java processes.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 12 Aug 2010, 18:00

Well, i uninstalled sfs, restarted pc ad then installed sfs again. now it doesn't give any error connecting to the database and the database is still there. This is so weird...

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 89 guests