I am attempting to connect with a SQL Server database using JDBC, the database I am attempting to connecto to consists of an area, and regrettably I've no treatments for the title, and so i can't change it out.

The code I am using is:

String jdbcString = "jdbc:sqlserver://" + hostname + ":" + port + ";databaseName=Database Name";
    try {
        connection = DriverManager.getConnection(jdbcString, username, password);
    }

I have also attempted following a instructions this link: http://msdn.microsoft.com/en-us/library/ms378428%28SQL.90%29.aspx by haveing the area inside braces:

String jdbcString = "jdbc:sqlserver://" + hostname + ":" + port + ";databaseName=Database{ }Name";

but that does not appear to operate either.

The mistake message I gee is:

ERROR: Couldn't connect to the database: The connection string contains a badly formed name or value.

I am while using latest JDBC driver from Microsoft.

All of this?

String jdbcString = "jdbc:sqlserver://" + hostname + ":" + port + ";databaseName={Database Name}";