Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connect to server then create database?

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James,
Not via JDBC. It is possible to do what you described, but you would need to use ssh commands rather than JDBC.
 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok Jeanne, thanks for that.
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rene,
It's not true for all databases. I was not aware mysql allows it.
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic