Results 1 to 2 of 2
  1. #1
    nancyhung is offline Member
    Join Date
    Jan 2008
    Rep Power

    Question connect JDBC to offline database


    I have MySQL Server 5.0 installed in computer C:/Program Files/MySQL/MySQL Server5.0/ and create a DB called "photo".

    I use JAVA programming to connect MySQL database by the following code and succeed,

    public class PhotoSQL {
    private String driver="com.mysql.jdbc.Driver";
    private String url="jdbc:mysql://localhost:3306/photo";
    private String username="root";
    private String password="12345";

    But, I also have a backup database "photo_bak" in D:/BackUp/

    is it possible to connect to database table in D:/BackUp/ with no MySQL Server installed in D:/??
    if possible, how to change the url path so that I can connect to database in D:/BackUp/ and get the data from it??

    Thank you very much!!


  2. #2
    Join Date
    Feb 2008
    Rep Power


    MySQL runs as a service on your machine. The data base file is not accessed directly by java, but instead via this service.

    Java can talk to a database using JDBC.

    You might want to try over at MySQL Forums for information on how to use your database backup.

Similar Threads

  1. Replies: 3
    Last Post: 09-18-2008, 04:07 PM
  2. Using JDBC to connect to ORACLE database
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-10-2008, 12:27 PM
  3. Problem to connect Database
    By Swamipsn in forum NetBeans
    Replies: 1
    Last Post: 08-07-2007, 08:13 AM
  4. Offline Web browser
    By one198 in forum New To Java
    Replies: 6
    Last Post: 08-02-2007, 04:54 PM
  5. Replies: 4
    Last Post: 06-05-2007, 02:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts