Online score database, confused...

Hi all ;D

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:

Here is a code snippit:


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… :clue:
Thank you :slight_smile:

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.

Thanx for the response Riven! :point:

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 :slight_smile:

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?

Hmmm, does MySQL not have a different syntax in it’s queries compared to traditional SQL?

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

Microsoft is widely known to do its own thing…

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.

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: