Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (547)
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  
  Online score database, confused...  (Read 2607 times)
0 Members and 1 Guest are viewing this topic.
Offline N15M0

Senior Newbie





« Posted 2011-07-02 13:01:18 »

Hi all Grin

Alrighty so straight to the question... Got a game working and want to host it on a website I created. Unfortunately I'm in a bit of a pickle now...

I created a scoring database which functions well with a test program on a local machine, and when I put the database on my website, I have no idea on how to link the program to the database.

Some additional information on the situation:
- The database is a Microsoft Access 2003 Database (with extention '.mdb')
- The database has its own url (eg: http://mywebsite.webserver.com/gamefiles/database.mdb)
- I use the JDBC/ODBC driver/bridge

Here is a code snippit:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
public DatabaseConnection()  //constructor method: sets up connection
     {
         try
         {
         String url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=XXXX";
         String nam = "name";
         String pass = "password";
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            conn = DriverManager.getConnection(
               url,nam,pass);
         
            JOptionPane.showMessageDialog(null,"Connection successful");
         }
         
             catch (ClassNotFoundException c)
            {
               JOptionPane.showMessageDialog(null,"Unable to load database driver");
            }
         
             catch(Exception e)
           
               JOptionPane.showMessageDialog(null,"Failed to get connection:\n"+e);
            }
      }


Where I put 'XXXX':
- Filling in the database name on the local machine works
- Filling in the online database url does not work, and a datasource name too long or other error is thrown.

Is there sometihng I am missing?
All comments are appreciated immensely...  Clueless
Thank you Smiley
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2011-07-02 13:20:43 »

Never ever make your database accessible to the outside world.

Write an application that runs on the webserver which handles (HTTP) requests and which handles the database access itself.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline N15M0

Senior Newbie





« Reply #2 - Posted 2011-07-03 19:03:55 »

Thanx for the response Riven!  Pointing

Are you suggesting I do something like have an Apache (or other) server running some webpages and a server application or applet to manage the database?

I have a colleague that has a server so doing this wont be a problem but I intend to test my theories an play around a bit before I move on drasticly, can you suggest any online webservers or services that are free to do such a thing? Or anything of the sorts? Online development is quite new to me and I've recently started learning JSP to script some webpages for my project, seeing as I have extensive Java knowledge already.

Thanks again  Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2011-07-03 20:03:07 »

Applets run on the client too, which means they have the same problem you started with.

It seems you want to run an application on the server, and from the looks of it, you require a Windows server, due to the MS Access database. It is highly unlikely that you'll find such a hosted platform for free.

Why not switch to say, MySQL and Apache, and ditch your Access database?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline N15M0

Senior Newbie





« Reply #4 - Posted 2011-07-03 20:34:46 »

Hmmm, does MySQL not have a different syntax in it's queries compared to traditional SQL?
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #5 - Posted 2011-07-03 21:16:47 »

Assuming Microsoft Access has no different syntax than 'traditional SQL' is hilarious.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline ra4king

JGO Kernel


Medals: 345
Projects: 2
Exp: 5 years


I'm the King!


« Reply #6 - Posted 2011-07-04 05:13:11 »

Microsoft is widely known to do its own thing...

Offline loom_weaver

JGO Coder


Medals: 17



« Reply #7 - Posted 2011-07-04 05:23:14 »

PHP is a good simple language for creating a web front-end to a database as per Riven's suggestion.  Or if you really want to you can stick with Java and find a hosting company that supports Java servlets.
Offline Salonika

Junior Newbie




while(alive) { code; play; }


« Reply #8 - Posted 2011-07-04 10:51:08 »

You could try some server side scripting either in java (jsp) or php.  Jsp can work with the java code of your game easier. You could also use a plain xml file if it is only for one database table ^^ There is a library that lets you alter and read xml files from a java programm  Wink
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.

atombrot (23 views)
2014-08-19 09:29:53

Tekkerue (22 views)
2014-08-16 06:45:27

Tekkerue (21 views)
2014-08-16 06:22:17

Tekkerue (12 views)
2014-08-16 06:20:21

Tekkerue (19 views)
2014-08-16 06:12:11

Rayexar (57 views)
2014-08-11 02:49:23

BurntPizza (37 views)
2014-08-09 21:09:32

BurntPizza (29 views)
2014-08-08 02:01:56

Norakomi (36 views)
2014-08-06 19:49:38

BurntPizza (66 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

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

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

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!