| Author |
Connect to server then create database?
|
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
Rather than connecting to a database in the normal manner, is it possible to use JDBC to connect to the (MySQL) server and then create a database dynamically?
Thanks,
James
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26138
|
|
James,
Not via JDBC. It is possible to do what you described, but you would need to use ssh commands rather than JDBC.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
|
ok Jeanne, thanks for that.
|
 |
Rene Larsen
Ranch Hand
Joined: Oct 12, 2001
Posts: 1179
|
|
Jeanne Boyarsky wrote:James,
Not via JDBC. It is possible to do what you described, but you would need to use ssh commands rather than JDBC.
Say what ???
You can do everything with JDBC on MySQL - and therefore is it also possible to use JDBC to create a database - you just need an admin user to log in with, and then create the database (or what it is you want to do).
Here is the SQL to use for the database creation: http://dev.mysql.com/doc/refman/5.0/en/create-database.html
|
Regards, Rene Larsen
Dropbox Invite
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26138
|
|
Rene,
It's not true for all databases. I was not aware mysql allows it.
|
 |
Rene Larsen
Ranch Hand
Joined: Oct 12, 2001
Posts: 1179
|
|
Jeanne Boyarsky wrote:Rene,
It's not true for all databases. I was not aware mysql allows it.
Point taken
The question from James was about MySQL, so I thought that it was about this DB your answer was.
|
 |
 |
|
|
subject: Connect to server then create database?
|
|
|