Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
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 3838 times)
0 Members and 1 Guest are viewing this topic.
Offline BloodRain

Junior Member





« Posted 2006-09-23 13: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 :
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
public static void connectToDatabase()
      {
      try
         {
      Class.forName("com.mysql.jdbc.Driver");      
         }              
   catch (ClassNotFoundException e)
         {
         System.err.println("Class not Found : "+ e);
         System.exit(1);
         }
   
      try
         {
         con=DriverManager.getConnection("jdbc:mysql://db1.xhost.ro/bloodrain_xhost_ro",User,Password);  
         }
      catch(SQLException e)
         {
         System.err.println("SQL Exception : "+ e);  
         System.exit(1);
         }        
      }


I get the following exception :

http://bloodrain.xhost.ro/exception.jpg

How can I make it work ? Huh
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


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

a) try http://www.hsqldb.org/
b) the screenshot doesnt work (and most likely png would have been the better choice)

弾幕 ☆ @mahonnaiseblog
Offline BloodRain

Junior Member





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

Ooops ...sorry . I got that error first time, then it worked.Now it seems it doesn't work anymore .try http://bloodrain.xhost.ro/ . 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: 1


pixels! :x


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

>but I guess it is slower

Its surprisingly fast actually... check the benchmarks:
http://www.polepos.org/

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 Ninja


Medals: 38



« Reply #4 - Posted 2006-09-23 20: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 Member





« Reply #5 - Posted 2006-09-23 23: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 Member





« Reply #6 - Posted 2006-09-24 00: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 Member





« Reply #7 - Posted 2006-09-24 09: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 Ninja


Medals: 20
Projects: 10


Age of Conquest makes your day!


« Reply #8 - Posted 2006-09-24 12: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 Member





« Reply #9 - Posted 2006-09-24 13: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


Current project release date: sometime in 3003


« Reply #10 - Posted 2006-09-24 14: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.

HTH

Endolf

Offline BloodRain

Junior Member





« Reply #11 - Posted 2006-09-24 16: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 Ninja


Medals: 38



« Reply #12 - Posted 2006-09-24 18: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 Member





« Reply #13 - Posted 2006-09-24 22: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 Member




my game will work, my game will work!


« Reply #14 - Posted 2006-09-29 14: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.

MickeyB

Current Project: http://www22.brinkster.com/mbowles/
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (27 views)
2014-07-29 18:09:19

Riven (16 views)
2014-07-29 18:08:52

Dwinin (14 views)
2014-07-29 10:59:34

E.R. Fleming (35 views)
2014-07-29 03:07:13

E.R. Fleming (13 views)
2014-07-29 03:06:25

pw (44 views)
2014-07-24 01:59:36

Riven (44 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org 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‑gaming.org
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!