connect mongo database special characters - database

A buggy software i'm using created a mongo database with a special character in its name.
The database name looks like : "database?authSource=Admin"
I would like to connect to this database "database?authSource=Admin", but this special character is wrongly interpreted by MongoClient.
I have tried to use URI encoding and connect to "database%3FauthSource%3DAdmin", but that does not connect me to the right DB.
How can I connect to a mongo database containing special characters ?

Related

Support For Utf-8 Using Progress Data Server For Oracle

I am using progress 10.2B with Oracle 9i as back end DB with use of progress data server for oracle. I created one schema holder and started it with parameters:
"-cpinternal UTF-8 -cpstream UTF-8 -cpterm UTF-8 -cpcase Basic -cpcoll basic".
Now I am connecting same schema holder and Oracle DB (residing on same server) from editor. While connecting to Oracle I am not specifying any data service name or port number. Once connected with above configuration, I am able to update data in table in Arabic form. Now when I am using service name and port number (of orabroker residing on same server) to connect to my schema and oracle DB, I am not able to update data in Arabic and some random data like "��������" is coming. Do I need to do any changes for UTF support for Orabroker? Are there any parameters for same?

Having trouble connecting to SQL Server database from VBA using ADO connection

I want to connect to a SQL Server database without using DSN. I'm receiving an error when trying to connect to said database. The error is
Run-time error '-2147467259 (80004005)': [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
My connection string looks like this:
"ODBC;DRIVER=SQL Server;SERVER=lokdb; UID=secret;PWD=secret;APP=Microsoft Open Database Connectivity;WSID=" & Environ$("COMPUTERNAME") & ";Network=DBMSSOCN;Trusted_Connection=Yes;DATABASE=EDMS-Lok"`
I am able to connect to the default database on the server with the credentials specified if I remove the DATABASE=EDMS-Lok parameter from the connection string, however I don't then seem to be able to "find" the EDMS-Lok database. E.g. if I try using
SELECT * FROM EDMS-Lok.dbo.eng_dwg
I get an error message
Run-Time error '-2147217900 (80040e14)': [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '-'
(eng_dwg is a valid table)
When I connect without specifying a database, the .DefaultDatabase property of the ADO connection object returns "020" which I don't even see as an available database on that server??
When connected, if I use SELECT name FROM sys.databases I'm able to get a list of the databases available. They are:
010
100
500
EDMS-Lok
Master
msdb
MSLLockDB
pubs
tempdb
I got it working using DSN, but I don't want to use DSN.
Not sure what is wrong here??
I would say the problem is that you mix up the authentication models. You provide user + password but also you have configured trusted connection = yes. I'm not sure how ADO works in that case but I would assume that it doesn't use the configured user and connects with the windows account. Delete the trusted connection parameter in the connection string and try again.
OK, credit for this answer should go to Dee and Sam who commented on the original question, however I can't mark a comment as the answer, so here it is:
Needed to wrap the database name in square brackets [ ] ... like this DATABASE=[EDMS-Lok] - (credit to DEE)
I first tried wrapping the database name in the connection string i.e. DATABASE=[EDMS-Lok] and this did not work (same error). However, if I connect without specifying the database, I'm able to access the table using SELECT * FROM [EDMS-Lok].dbo.eng_dwg
It didn't work in the connection string because the string is not T-SQL code. To get it to work, you may need to figure out how to escape the dash character. – (credit to SAM)
I've tried single and double quotes, backslash, square brackets, parentheses and curly brackets and nothing seems to work to escape the hyphen in the database name within the connection string. But, since I can now access the database and the tables I need, which was the original question, I wanted to mark it as answered.

Incorrect encoding using jruby with datamapper

I'm trying to get data form a 2008r2 MSSql server using jruby and datamapper.
The only problem I've got this far is correct character coding in jruby.
Database uses Polish_CI_AS collation, testing field is populated with: "ą ę ś ć".
Fetching that field from within jruby results in: "uFFFD uFFFD uFFFD uFFFD" which are default replacement strings for utf-8.
I've tried setting the -E variable to windows-1250, it changes the characters displayed but as in Utf-8 they are displayed in the same manner. Also tried to include # encoding: Windows-1250, but it doesn’t help either.
I’m pretty sure it has something to do with datamapper or the db connection but jdbc does not supports (AFAIK) encoding variables.
UPDATE
My connection string: DataMapper.setup(:default, 'sqlserver://servername/database;instance=InstanceName;domain=DOMAIN')
The connection works well with MS JDBC, datamapper uses jTDS which uses UTF8 encoding as default.
I've checked the jTDS documentation and found that I needed to add: charset=cp1250; property at the end of my connection string. It all works well now.

"Server" vs "Data Source" in connection string

I'm new to SqlServer, right now I have SqlLocalDb installed to work locally. Good, but I can see two connection strings typically and both works:
Data Source=(localdb)\v11.0;Integrated Security=true;
and
Server=(localdb)\v11.0;Integrated Security=true;
What exact difference is there between the two?
For the full list of all of the connection string keywords, including those that are entirely synonymous, please refer to the SqlConnection.ConnectionString documentation:
These are all entirely equivalent:
Data Source
Server
Address
Addr
Network Address
... There is no difference between Server and Data Source as they represent the same thing for SQL Server : the full name of the SQL Server instance with the syntax "MyComputerName\MyShortInstanceName" , potentially including the port used by the SQL Server instance to communicate.
Reference: http://social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/7e3cd9b2-4eed-4103-a07a-5ca2cd33bd21
They are synonymous - you can use either one.
That is - as far as the framework is concerned, they are the same.
My favorite set up is one that doesn't contain any spaces. In the simplest form, one has to provide four values - the URL, the container, the user and the credential.
server
database
user (or uid)
password (or pwd)
So a connection string looks like this.
server=stuffy.databases.net;database=stuffy;user=konrad;password=Abc123(.)(.);

Specifying a named SQL Server instance for nhibernate

I've been making a first attempt to use fluent nHibernate on an ASP.NET MVC 3 application. Because I have multiple instances of SQL Server Express, I've been trying to specify a named instance along with the server while creating a session factory with the Fluently.Configure() method. My connection string for the database is of the format:
Server=myServerName\theInstanceName;Database=myDataBase;Trusted_Connection=True;
This causes an nHibernate exception reading:
Format of the initialization string does not conform to specification
starting at index 19
where the index given corresponds to the slash before the instance name. This connection string works fine with Entity Framework 4. So how am I to specify the named instance I want to connect to in nHibernate?
Since you are doing that in code, you must escape the \ either by doubling it (\\) or by using a verbatim string:
connectionString = #"Server=myServerName\theInstanceName;Database=myDataBase;..."
Otherwise, \t is interpreted as the tab character.

Resources