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