aspose file tools*
The moose likes JDBC and the fly likes Using create=true; in JTDS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using create=true; in JTDS" Watch "Using create=true; in JTDS" New topic
Author

Using create=true; in JTDS

Franklin Wormwood
Greenhorn

Joined: Jun 16, 2014
Posts: 17
I understand in Apache Derby, if you put

create=true;

in the connection URL, the driver will create the database if the database does not exist. Can we do the same in JTDS?

Connection connection = DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/sample;create=true", "user", "password");

But I'm getting an sqlException saying the object sample cannot be found. How can I do this in JTDS?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
I highly doubt that creating a DB is possible via connection parameters for any DBs aside from the likes of Derby and HSQLDB.


Ping & DNS - my free Android networking tools app
Franklin Wormwood
Greenhorn

Joined: Jun 16, 2014
Posts: 17
Ulf Dittmer wrote:I highly doubt that creating a DB is possible via connection parameters for any DBs aside from the likes of Derby and HSQLDB.

That's too bad. I'm trying to run Marty Hall's example on creating a db using JDBC. He did it on Apache Derby, I was hoping to try it in sql server cause sql server is the dbms in my machine.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
What's the problem with creating the DB manually?
Franklin Wormwood
Greenhorn

Joined: Jun 16, 2014
Posts: 17
Ulf Dittmer wrote:What's the problem with creating the DB manually?

Not at all. Though you wouldn't normally create databases from java, It's just interesting if you can do that in java.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Those two DBs can operate in non-persistent mode, holding the data completely in-memory. It makes sense to create the DB programmatically as well in that case.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using create=true; in JTDS