Page 1 of 1

Please, help with DB Connection

Posted: 02 Sep 2009, 11:22
by kaligus
Hello,

please, I tried everything about this... I cant make my MySQL server connect with SFS... the messages says it just cant connect to the mysql.driver... I download already the JDBC file and put into the jre/lib/ext, but keeps going on the error.

I tried to put in the brackets <Driver></Driver> of the config.xml everyth path I thought, including this one:
<Driver>org.gjt.mm.mysql.Driver</Driver>

And also the pasth of my windows.

Can anyone help me? I did everything the docs said.

Posted: 02 Sep 2009, 12:19
by ThomasLund
I think thats a question more for the "regular" parts of the forums. Someone should be able to help you there!

:-)

/Thomas

Posted: 02 Sep 2009, 12:30
by kaligus
Ok, sorry Thomas.

Anyway, I solved. I mean... I think I put the mysql driver in a wrong place.

:oops:

mysql connection

Posted: 05 Oct 2009, 09:51
by fotios
Hi there,

I have the same problem (I guess) connecting SFS to mysql. I added the mysql jdbc (mysql-connector-java-5.0.8-bin.jar) connector under my ${JAVA_HOME}/lib/ext in redhat.

I still get the same issue. SFS cannot connect with the mysql server. Can you please tell me how you fix it? I use the testSQL query in the config.xml and because of it, SFS cannot restart.

I tested a sample java program I wrote and it connects with the server.

Thanks a lot in advance.

Posted: 05 Oct 2009, 10:07
by kaligus
Hey man,

Ok, I did this checks to make sure it was working:

- Check the jar file of mysql (double click and execute).
- The test script of SFS to test mysql must have the right IP address and the table must be a valid one of your server (also, the server must be running, of course). If the SQL commands are wrong, it will return a message.
- Check the username and password of your mysql, must be equal into sfs config xml file.

My code:

Code: Select all

<DatabaseManager active="true">

                <Driver>org.gjt.mm.mysql.Driver</Driver>
            <ConnectionString>jdbc:mysql://172.29.38.218:3306/gg</ConnectionString>
            
            <UserName>root</UserName>
            <Password>myMySQLpassword</Password>
            
            <TestSQL><![CDATA[SELECT COUNT(*) FROM usuarios]]></TestSQL>

            <MaxActive>1</MaxActive>
            <MaxIdle>1</MaxIdle>

            <OnExhaustedPool>fail</OnExhaustedPool>
            <BlockTime>5000</BlockTime>

         </DatabaseManager>

Posted: 05 Oct 2009, 23:16
by fotios
Thanks so much for the quick reply!

Well, my code is very similar to yours. The problem might be with the ip of the mysql server. I use localhost now:
<ConnectionString>jdbc:mysql://localhost:3306/smartfox_test</ConnectionString>

Smartfox and my database are now installed on the same machine, so it should work. I wonder if it needs the external ip of the mysql server.

Thanks again!

Posted: 06 Oct 2009, 10:14
by kaligus
Maybe you right...
My first problem was due to the mysql jar file... I put in the wrong place. Then I had another problem and it was my local IP.

That IP above is from my MySQL from my work... and this one is from my home:

<ConnectionString>jdbc:mysql://127.0.0.1:3306/gg</ConnectionString>
Try the IP above.
where "gg" is my database.

Also check the SQL code, it must be a valid one to work.

:wink: