Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

database, mysql

Options
  • 30-03-2005 8:59pm
    #1
    Closed Accounts Posts: 10


    hi, just a quick question to know is this possible.

    I have a java programme that uses a database.I know that mysql by default stores the actual database in mysql>data folder but im wondering is it possible to instruct my programme to store it else where ie where it can be found easier for a user to keep a copy of. Im also wondering is it possible to instruct my programme to where the database is located.

    Even if someone knows if this is possible thats enough and ill keep search for how its done.Cheers.


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    MySQL keeps all its databases central for the very reason that it doesn't have to go hunting and loading from all over the place. As well as that, unlike Access, a MySQL database isn't a single file, its a minumum of three per table (in my experience).

    I guess it would be possible to have your program edit MySQLs configuration file to point to the databases root folder, but that defeats the purpose of it, as you almost certainly need to restart the service afterwards, and you won't be able to have two concurrent databases open that way.


  • Registered Users Posts: 4,188 ✭✭✭pH


    It is possible in MySQL to change the datadir where the physical database files are located, but it is not possible for a java application to specify a filesystem location for the database.


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Sure it is, you just read it in using a JFileChooser set to select directories, and parse that path into the configuration file. But like I said, that requires you to restart the service.


  • Closed Accounts Posts: 10 gintreach


    But if i had so mysql was changed so that it just pointed to lets say the desktop folder would it then be able to find the correct database as each database has its own folder.
    its only a simple database for storing information and im wanting the user to chooses what database is loaded up for the software.Its part of my software for my final year project.
    Thanks for your help by the way.


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Yeah, its possible. I have two seperate MySQL installations on different partitions looking at the databases stored in a third. In your my.conf (or my.ini file, whichever you're using) change the datadir entry under the [mysqld] header to the directory you want.


  • Advertisement
  • Closed Accounts Posts: 10 gintreach


    When i change the my.ini file to point some where else it fails to start up as its missing some files there it needs also to start up the database(im using an older version of mysql where i start up the service by the command prompt).


Advertisement