DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2003

    Database over the Internet

    I got a big problem with some java over the Internet. I wanna make a Applet who can save data in a database, over the internet ( ftp )
    Havent tried this kind of database before but what do I need to change in this code belove to make it work?? I guess I need some kind of url, username, and password right??
    Plz help me!!!

    protected void insertObjectInStorage(OID oid, Object object)
    Spillere s = ( Spillere )object;
    Connection con = null;
    Statement stmt = null;
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
    con = DriverManager.getConnection("jdbcdbc:bgladder");
    stmt = con.createStatement();
    stmt.executeUpdate("INSERT INTO Spillere VALUES ( '" + oid.toString() + "', '"+s.getNavn() + "', '"+ s.getPassword() + "', '"+ s.getWins() + "', '" + s.getLoss() + "', '" + s.getPoints() + "' )");

    catch(Exception ex)
    System.err.println("Der er fejl -->" + ex.getMessage() );


  2. #2
    Join Date
    Jun 2003
    I once had a problem similer to the one you have, so I hope my solution can help you.

    You downloaded the JDBC driver, If I'm not mistaking it is a .jar file. Take the java applet and put in in a HTML page. Put that html page on the same server as your database is. Let's put in a folder called html

    Now unpack the .jar file (winace of winrar can do the job...on a windows machine that is) when unpacked there should be a org folder. put in also on the server where the database is. Put it in the same place where the html folder is.

    This is what worked for me, I hope it also works for you

  3. #3
    Join Date
    Jun 2003
    Ok thx dude, but what about my code?? It have to be modified to be used like that right? like odbc.jdbc:bgladder

    it cant see this because its on a server I guess.
    What do I change this to ?

  4. #4
    Join Date
    Jun 2003
    Uhm, now this is a difficult question...i missed out on a piece of important information...The JDBC I used is to connect with a PostGre SQL database, if you use a different database language your .jar file may be a bit different, but it probably has the same structure.

    To work from my own code, you indeed need to change your code a bit:

    Class.forName("org.postgresql.Driver"); //org is the main folder in the .jar file I used. In that is a folder called postgresql and Driver is a .class file

    conn = DriverManager.getConnection(url, userName, passWord);

    //url is the adress the applet needs to point to i.e.:


    The fist four * are the adress where of the server, this might be more or less, depending on the adress. The fifth * is the poort / gate (I don't know the proper English word) and the last is the database name.

    If you need a username and password you can also fill it in here. Use strings for the url, username and password.

  5. #5
    Join Date
    Jun 2003
    Ok thx man but what if it is a microsoft access database?

  6. #6
    Join Date
    Jun 2003
    As far as I know you can't just run an Access database on a server. This is what you need to do. You need to export your database into SQL. Change the SQL in the dialect you use and put it on the server (I wish I could help you on this, but I can't. I never did this.) Then make a new empty database in Acces and import the database in Acces...

    I'm sorry, but if you need more help on the database, I can't help you...With Java, well...I can give some more support there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.