aspose file tools*
The moose likes JDBC and the fly likes Connect to server then create database? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connect to server then create database?" Watch "Connect to server then create database?" New topic
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: 29281
    
140

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: 29281
    
140

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connect to server then create database?
 
Similar Threads
Trigger with Two database
MySQl with Eclipse3.2
Database Daemon Connection
Connection String
Connecting between Applet and database