create remote db via JDBC?

Discussion in 'Java' started by iksrazal@terra.com.br, Jul 4, 2005.

  1. Guest

    Hi all,

    >From the command line on the local machine I do this:


    /home/iksrazal> mysql -u user -ppassword mydb < mydb.sql

    That creates a new db instance and populates the tables with default
    data. I need to:

    1) Create a new db with the file shown from inside a servlet container.

    2) The file could be anywhere on the same machine as the servlet
    container.
    3) The db is on another machine.
    4) The db is mysql 4.1 .

    What I think does not work is mysqlimport - as it seemingly only works
    with tables, not a full db. And RunTimeExec - as how would I do that
    when the db is remote?

    Any ideas?
    iksrazal
     
    , Jul 4, 2005
    #1
    1. Advertising

  2. Guest

    I just remembered RunTimeExec could work as the mysql command accepts a
    host name. But is RunTimeExec the only way ? I'd prefer another way,
    such as with directly with JDBC, if possible.
     
    , Jul 4, 2005
    #2
    1. Advertising

  3. Joan Guest

    <> wrote in message
    news:...
    > Hi all,
    >
    > >From the command line on the local machine I do this:

    >
    > /home/iksrazal> mysql -u user -ppassword mydb < mydb.sql


    the mydb.sql file contains ordinary sql commands, just put them in your
    program instead

    >
    > That creates a new db instance and populates the tables with default
    > data. I need to:
    >
    > 1) Create a new db with the file shown from inside a servlet container.
    >
    > 2) The file could be anywhere on the same machine as the servlet
    > container.
    > 3) The db is on another machine.
    > 4) The db is mysql 4.1 .
    >
    > What I think does not work is mysqlimport - as it seemingly only works
    > with tables, not a full db. And RunTimeExec - as how would I do that
    > when the db is remote?
    >
    > Any ideas?
    > iksrazal
    >
     
    Joan, Jul 4, 2005
    #3
  4. Guest

    >
    > the mydb.sql file contains ordinary sql commands, just put them in your
    > program instead
    >


    Excellent idea and I gave it a shot. But the comments get in the way,
    and even assumming I could parse those out, I still get commands like
    this:

    SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS;

    And

    USE `c4`;

    That sort of thing. The file I have is direct from mysqldump and I want
    to execute it as is.

    iksrazal
     
    , Jul 5, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Albretch
    Replies:
    9
    Views:
    2,569
    Andrew Thompson
    Jul 28, 2004
  2. Keith Wansbrough

    Re: jdbc help:sun.jdbc.odbc.JdbcOdbcDriver

    Keith Wansbrough, Aug 16, 2004, in forum: Java
    Replies:
    0
    Views:
    757
    Keith Wansbrough
    Aug 16, 2004
  3. Betty
    Replies:
    1
    Views:
    9,873
    Juha Laiho
    May 21, 2005
  4. Jesus M. Salvo Jr.
    Replies:
    2
    Views:
    4,254
    robert
    Feb 11, 2006
  5. Bruce
    Replies:
    4
    Views:
    759
    Bjorn Abelli
    Mar 25, 2006
Loading...

Share This Page