Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (592)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (645)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Java+MySql  (Read 4066 times)
0 Members and 1 Guest are viewing this topic.
Offline BloodRain

Junior Devvie

« Posted 2006-09-23 11:20:24 »

I want to try some online game using only a database.The game will probably be turned based.Anyway ... I want to connect to a mysql database from an J2SE application that runs on the user's computer.
When I try to connect to the database with :
public static void connectToDatabase()
   catch (ClassNotFoundException e)
         System.err.println("Class not Found : "+ e);
      catch(SQLException e)
         System.err.println("SQL Exception : "+ e);  

I get the following exception :

How can I make it work ? Huh
Offline oNyx

JGO Coder

Medals: 2

pixels! :x

« Reply #1 - Posted 2006-09-23 12:48:03 »

a) try
b) the screenshot doesnt work (and most likely png would have been the better choice)

弾幕 ☆ @mahonnaiseblog
Offline BloodRain

Junior Devvie

« Reply #2 - Posted 2006-09-23 16:37:24 »

Ooops ...sorry . I got that error first time, then it worked.Now it seems it doesn't work anymore .try . I'll try the link. Thanks  Smiley

I tried the link.It is an interesting project , but I guess it is slower and smaller than mysql or oracle...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline oNyx

JGO Coder

Medals: 2

pixels! :x

« Reply #3 - Posted 2006-09-23 17:10:35 »

>but I guess it is slower

Its surprisingly fast actually... check the benchmarks:

Also... if you want to use mysql the users need to run that one, too. Which is sorta shit. Its really far from being practical for a game... eh oh... you want to connect to some *remote* database. Man... thats scary. Everyone could just sniff user/pass and do something silly with the database. Nah... dont do that. Smiley

弾幕 ☆ @mahonnaiseblog
Offline cylab

JGO Wizard

Medals: 85

« Reply #4 - Posted 2006-09-23 18:13:57 »

Also a lot of users probably cannot connect to the database because of firewall issues (maybe you just hit the same as cause of your error)

Mathias - I Know What [you] Did Last Summer!
Offline BloodRain

Junior Devvie

« Reply #5 - Posted 2006-09-23 21:57:01 »

I will bother later about security and performance (I heard that SSL can encrypt my password). I am not sure what I want to do so I might make a simple game applet that saves the score . And this shouldn't be such a bad idea... What about World of Warcraft or Guild Wars . Don't they use a database to store the positions , the levels etc. ?Anyway ...I'll use this or I don't , I would still like to know why this is not working.

About the java database , I don't have enough time to learn that now (School Sad ) .
Offline Martin Strand

Junior Devvie

« Reply #6 - Posted 2006-09-23 22:28:42 »

SSL only encrypts traffic, you will still need to store your db password on the client (= very bad idea)
You shouldn't let clients connect directly to your db, instead let them connect to a a server app which handles things. That server app may use a db as a backend, but then you're in control of the db traffic (= much lower security risk).
Offline BloodRain

Junior Devvie

« Reply #7 - Posted 2006-09-24 07:45:14 »

I would like to make the game without a server because I don't want to keep my pc open all the time.There are programs that make java harder to decompile by adding some assambly code into the source or something like that.
But supposing I'm using the software just for conneting myself to a remote database this should work fine.  Cry
Offline noblemaster

« JGO Spiffy Duke »

Medals: 24
Projects: 10

Age of Conquest makes your day!

« Reply #8 - Posted 2006-09-24 10:34:17 »

You need a server! Otherwise, people just start hacking your database, because you give them the username and password when they download the client. There is NO way to encrypt etc. the password ... Encryption does not work that way.

Offline BloodRain

Junior Devvie

« Reply #9 - Posted 2006-09-24 11:42:42 »

Ok then... I guess that an applet will work the same way Sad
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #10 - Posted 2006-09-24 12:54:22 »

You might be able to do something with HTTP posts if you have a web space provider that allows CGI scripts. Then the database access is handled from the CGI web space end.



Offline BloodRain

Junior Devvie

« Reply #11 - Posted 2006-09-24 14:01:03 »

10x for your answers.It was just for learning purposes so the security it's not very important. What if I am the only person that has the software that connects to the database ? With or without security this must work somehow...I'll search more.Thanks again.
Offline cylab

JGO Wizard

Medals: 85

« Reply #12 - Posted 2006-09-24 16:51:44 »

There is little gain in trying to do the wrong thing to learn the right thing...

Mathias - I Know What [you] Did Last Summer!
Offline BloodRain

Junior Devvie

« Reply #13 - Posted 2006-09-24 20:57:13 »

Then just consider it is a server application and I will run this code only on the server so that I can connect to the database .Anyway.. someone who saw this topic but it is still waiting the for his account to be approved (I guess it is a bug or something because he says he waits for over 2 weeks...) sent me an email with some explinations.
Offline MickeyB

Senior Devvie

my game will work, my game will work!

« Reply #14 - Posted 2006-09-29 12:50:03 »

My Galaxy Traders game server gets all of its data from MySql...very nice and fast.  (though I am going to make a version for SGS later).  Have a server app that does all the db communication and clients talk with server only.


Current Project:
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Za\'Anzabar (15 views)
2015-06-29 05:44:54

TritonDreyja (31 views)
2015-06-24 17:10:40

CopyableCougar4 (27 views)
2015-06-23 00:34:45

BurntPizza (32 views)
2015-06-21 20:36:46

cookiecompiler (74 views)
2015-06-11 15:42:53

cookiecompiler (38 views)
2015-06-11 15:41:14

NegativeZero (63 views)
2015-06-11 09:49:18

Fairy Tailz (88 views)
2015-06-11 01:59:47

chrislo27 (60 views)
2015-06-06 18:12:44

Burnsalan20 (72 views)
2015-06-05 03:00:51
How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!