Amazon's SimpleDB for custom login?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

shaka
Posts: 45
Joined: 30 May 2011, 19:39

Amazon's SimpleDB for custom login?

Postby shaka » 04 Aug 2011, 22:24

I'm completely new to MySQL and databases in general, so I'm wondering if it's possible to use Amazon Web Services' SimpleDB for custom logins? (and in the future, storing information about players?)

The reason I ask this is because there is no username/password for simpleDB (they use access and secret keys), so I'm not sure if SFS2X is compatible with it. More specifically, how would I use the zone configurator to connect my zone and simpleDB?

Also, a semi-related question: Is it okay to install MySQL and SFS2X on the same EC2 server, or do things start conflicting?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 05 Aug 2011, 09:49

hi. I think sfs2x supports every db that has a java connector, like h2 and mysql, so, if that database has a java connector, sfs2x may support it.

Regarding your second question, my opinion is that they wont conflict, but if the system isn.t powerful enough, it may not handle both at the same time. There are pros and cons about having the database in the same machine as the server. For example, if they are in the same machine, the connection is instant. So, the best way may be having them in different machines but that are in the same network, or maybe in the cloud.

Hope this helps
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
shaka
Posts: 45
Joined: 30 May 2011, 19:39

Postby shaka » 05 Aug 2011, 19:44

Thanks rjgtav, good to know.

I have another question though - I can't find anything on the forums on how to use the zone configurator to connect to an amazon simpledb. Can anyone point me in the right direction?
tchen
Posts: 191
Joined: 11 Dec 2010, 14:14

Postby tchen » 07 Aug 2011, 19:08

Between

http://code.google.com/p/simpledb-jdbc/

and

viewtopic.php?p=41534

you should hopefully have enough to load in the simpledb-jdbc driver and fill in the key/secret parameters.

Cheers,
tchen
shaka
Posts: 45
Joined: 30 May 2011, 19:39

Postby shaka » 08 Aug 2011, 15:52

Thanks tchen for the links! I'll try working with those :D
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 08 Aug 2011, 16:17

@tchen: Good to know :)
@shaka: Let us know how it works for you
Lapo
--
gotoAndPlay()
...addicted to flash games
shaka
Posts: 45
Joined: 30 May 2011, 19:39

Postby shaka » 12 Aug 2011, 02:23

I've put the simplejdbc-0.3.2.jar (downloaded from the simpleJDBC google code site) in my SFS lib extension folder (SFS2X-RC1b/SFS2X/extensions/__lib__/)

In the zone folder, I have:

Code: Select all

 <databaseManager active="true">
    <driverName>com.beacon50.jdbc.aws.SimpleDBDriver</driverName>
    <connectionString>jdbc:simpledb://sdb.amazonaws.com</connectionString>
    <userName>(amazon access key)</userName>
    <password>(amazon secret key)</password>
    <testSql>SELECT COUNT(*) FROM cherry</testSql>
    <maxActiveConnections>10</maxActiveConnections>
    <maxIdleConnections>10</maxIdleConnections>
    <exhaustedPoolAction>FAIL</exhaustedPoolAction>
    <blockTime>3000</blockTime>
  </databaseManager>


In my simpleDB, I have 1 domain named "cherry" with 2 attributes: "username" and "password".

However, I'm getting an error when trying to start the server:
Image

I'm at a loss for why this happens, since I put the simplejdbc jars in SFS2X/lib and SFS2X/extensions/__lib__/

Can someone help me?
Last edited by shaka on 19 Aug 2011, 03:40, edited 1 time in total.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 12 Aug 2011, 08:17

Hi. After googling a little, i think that maybe you need the AWS SDK and to add it to the SFS2x lib? I say this because all the posts i find regarding this error are posts regarding the AWS SDK.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
shaka
Posts: 45
Joined: 30 May 2011, 19:39

Postby shaka » 13 Aug 2011, 00:09

Hi,

i put the following files in both SFS2X/lib and SFS2X/extensions/__lib__/:
aws-java-sdk-1.2.6.jar
aws-java-sdk-1.2.6-javadoc.jar
aws-java-sdk-1.2.6-soruces.jar

(all downloaded from http://aws.amazon.com/sdkforjava/)

but I still get the same error...
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 13 Aug 2011, 20:09

Hum... sorry no clue then... Maybe someone else has already made this or has an idea?
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
User avatar
levancho
Posts: 71
Joined: 27 Jun 2011, 16:03

Postby levancho » 14 Aug 2011, 05:06

issue might be classLoader related,
shaka
Posts: 45
Joined: 30 May 2011, 19:39

Postby shaka » 23 Aug 2011, 03:12

I'm still stuck on this. Can anyone help me please?

Right now, my zone's database manager has:

Code: Select all

 <databaseManager active="true">
    <driverName>com.beacon50.jdbc.aws.SimpleDBDriver</driverName>
    <connectionString>jdbc:simpledb://sdb.amazonaws.com</connectionString>
    <userName>(amazon access key)</userName>
    <password>(amazon secret key)</password>
    <testSql>SELECT COUNT(*) FROM cherry</testSql>
    <maxActiveConnections>10</maxActiveConnections>
    <maxIdleConnections>10</maxIdleConnections>
    <exhaustedPoolAction>FAIL</exhaustedPoolAction>
    <blockTime>3000</blockTime>
  </databaseManager>


I've put simplejdbc-0.3.2.jar inside SFS2X/lib, but I still get an error:

Code: Select all

Exception in thread "main" java.lang.NoClassDefFoundError: com/amazonaws/auth/AWSCredentials
        at com.beacon50.jdbc.aws.SimpleDBDriver.connect(SimpleDBDriver.java:40)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:75)
        at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)
        at org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:180)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at com.smartfoxserver.v2.db.SFSDBManager.getConnection(SFSDBManager.java:113)
        at com.smartfoxserver.v2.db.SFSDBManager.executeQuery(SFSDBManager.java:139)
        at com.smartfoxserver.v2.db.SFSDBManager.executeQuery(SFSDBManager.java:122)
        at com.smartfoxserver.v2.db.SFSDBManager.testSQLStatement(SFSDBManager.java:334)
        at com.smartfoxserver.v2.db.SFSDBManager.init(SFSDBManager.java:65)
        at com.smartfoxserver.v2.entities.managers.SFSZoneManager.configureDBManager(SFSZoneManager.java:630)
        at com.smartfoxserver.v2.entities.managers.SFSZoneManager.createZone(SFSZoneManager.java:401)
        at com.smartfoxserver.v2.entities.managers.SFSZoneManager.initializeZones(SFSZoneManager.java:240)
        at com.smartfoxserver.v2.SmartFoxServer.start(SmartFoxServer.java:215)
        at com.smartfoxserver.v2.Main.main(Main.java:31)
Caused by: java.lang.ClassNotFoundException: com.amazonaws.auth.AWSCredentials
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 19 more


Do I have to put the jar somewhere else? Is my drivername/connection string wrong?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 23 Aug 2011, 07:18

This is interesting. When i added simple jdbc to the lib of my sfs2x, i started getting double logs, so i got, for example, 2 times the SFS2x Ready message :lol:

BTW, when i opened the simple jdbc tar.gz file, i found that it has all the dependencies in the lib folder, so maybe you should add all of them to the sfs2x lib folder. There's also an aws-java-sdk file in there, i'm sure thats the file you need for it to stop giving that error.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
shaka
Posts: 45
Joined: 30 May 2011, 19:39

Postby shaka » 23 Aug 2011, 17:45

rjgtav wrote:This is interesting. When i added simple jdbc to the lib of my sfs2x, i started getting double logs, so i got, for example, 2 times the SFS2x Ready message :lol:

BTW, when i opened the simple jdbc tar.gz file, i found that it has all the dependencies in the lib folder, so maybe you should add all of them to the sfs2x lib folder. There's also an aws-java-sdk file in there, i'm sure thats the file you need for it to stop giving that error.


Hey rigtav, thanks for your help!

Yea, I got the same double log thing when putting it in :shock:. Now, even after a clean reinstall, it won't go away...

I tried putting the dependencies (found in the lib folder) into SFS2X/lib, but I still get the same error :( . I also tried putting it in SFS2X/lib/Lib, but got the same result. Got any other leads?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 23 Aug 2011, 19:55

hum.. Sorry, i cant help much further as my sfs simply closes after getting some error that isn.t logged (maybe because i dont have an aws server). Maybe if we could do teamviewer or something like that, i could try to help.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Stevenor and 97 guests