EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB489194: Error “Invalid schema name” occurs when using JDBC to connect to MongoDB databases with hyphen in names.


Yingjia Cao

Cloud Support Engineer II • MicroStrategy


This article explores a common problem encountered by users attempting to connect to MongoDB via JDBC when the database name in the connection string includes a hyphen ("-"). While ODBC connections handle hyphenated database names without issues, JDBC connections result in an error message stating "Invalid Schema Name" because special characters are removed. This guide offers a solution to facilitate successful JDBC connections under these circumstances.

Symptom

When attempting to establish a JDBC connection to a MongoDB database where the database name includes a hyphen ("-"), users encounter a connection failure. This failure is accompanied by an error message indicating an invalid schema name due to special characters being stripped.

JdbcConnectionWrapper::Connect failed. Error type: Jdbc error. Jdbc operation attempted: Connect. [42000:-4850: on SQLHANDLE] [Strategy][MongoDB JDBC Driver][MongoDB]Invalid schema name. The specified database may not exist or your user id may lack the necessary permissions to read from it. Another possibility is that the schema name contains special characters which have been stripped (see the 'specialCharBehavior' option for details). Schema name: example-test

Steps to Reproduce

1. Go to Workstation to create a new data source, including create a new Database connection to input the Host, Port, Database, Authentication mode and select the Database Login for the connection to Mongo DB.
The used connection string like below:


JDBC;DRIVER={com.Strategy.jdbc.mongodb.MongoDBDriver};URL={jdbc:Strategy:<mongo db URL>;DatabaseName=example-test;EncryptionMethod=noEncryption};



2. Test the connection and error occurs.

Solution

To establish a JDBC connection to MongoDB when the database name includes a hyphen, please follow these steps:
1. Open Workstation Data Source to edit the MongoDB JDBC Database Connection.
2. Navigate to the "Advanced" tab to modify Advanced Settings.

ka0PW0000005lr7YAA_0EMPW00000Nz1Rl.jpeg

3. Update the Driver Properties by adding the following property:

SpecialCharBehavior=Include;

4. Configure Schema Mapping by specifying the schema map path with following property:

SchemaMap=<self defined path>/Mongotest.config;



5. Confirm and save the modifications to your JDBC connection settings.
By following these steps, the connect to MongoDB Atlas database using JDBC is successfully, even if the database name contains a hyphen.


Comment

0 comments

Details

Knowledge Article

Published:

May 28, 2025

Last Updated:

May 28, 2025