I can find dozens of examples of a connectionString entry in Web.config, but there appears to be no comprehensive definition of the values in the string. What do the following mean:
Data Source -- This appears to be the server identity, but that could be a misinterpretation
Initial Catalog
AttachDbFileName -- Seems to be the file name of the DB file, but how does this relate to Initial Catalog? And what does |DataDirectory| mean when included in the name?
Integrated Security -- I assume that "True" means that "Windows Authentication" is used vs "SQL Server Authentication", but that's only a guess.
UserID/Password -- Used only in a few odd examples. Not clear when these might/might not be needed.
server -- I see this in some rare examples -- how different from Data Source?
database -- Ditto.
MultipleActiveResultSets -- ??
That's all documented right here on MSDN.
DataSource: The name or network address of the instance of SQL Server to which to connect.
Intial Catalog: The name of the database that will be in scope when connecting.
AttachDbFileName: he name of the primary database file, including the full path name of an attachable database. AttachDBFilename is only supported for primary data files with an .mdf extension.
Integrated Security: When false, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication.
User ID / Pasword: Used for SQL authentication.
Server: Similar purpose as DataSource, but appears to support different syntaxs depending on your needs.
MultipleActiveResultSets: When true, an application can maintain multiple active result sets (MARS). When false, an application must process or cancel all result sets from one batch before it can execute any other batch on that connection.
There is a lot more detail on each of these in the documentation.
You can also refer to the site http://www.connectionstrings.com
It is a great resource when it comes to play with connection strings for various database systems
Related
As the title states, if I connect to my heroku posgresql DB via pgAdmin4 I see many other databases which I am not allowed to access.
I know there must be a restrction DB field somewhere but I cant find it.
In pgAdmin4 its not in the advanced tab as stated here:
StackOverflow similar Question pgAdmin3
Actually, you can hide the rest of databases.
When you fill in all credentials and connections parameters for the serevr, in order to avoid parsing so many databases, we have to white list only those databases we care about.
Go to the Advanced tab and under db restriction copy the database name (it’s the same value as the Maintenance database field filled earlier). Remember - you have to set up this parameter BEFORE you hit "Save" as you cannot modify this field after saving.
Source: https://medium.com/#vapurrmaid/getting-started-with-heroku-postgres-and-pgadmin-run-on-part-2-90d9499ed8fb
You're probably using a Hobby-Dev or Hobby-Basic database. These used shared infrastructure. Although you can see the other (obfuscated) DB's in the list, you do not have access to them. To avoid seeing them, specify the DB name in your connection settings in pgAdmin.
Anyone know why the Netbeans IDE's Database result explorer disables CrUD operations and "Show SQL 'CrUD' Operation" when using a JDBC connection via JTOpen 9.1 driver to a DB2 for i database with Netbeans 8.1?
JTOpen is a open source JDBC driver to IBM i DB2 for i database in addition to bunch of Java Classes for interacting with the IBMi system. http://jt400.sourceforge.net/
I tried a few JDBC connection properties but no cigar...
I guess i'll have to keep browsing the IBM KB
http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzahh/jdbcproperties.htm
and the JT400 source
https://github.com/devjunix/libjt400-java/blob/master/src/com/ibm/as400/access/JDProperties.java
Many DB2 for i systems are configured to not use commitment control or journaling. This is not what many toolkits expect to see. Try changing the connection string to tell Netbeans that you don't want commitment control.
Add "extended metadata=true" in the connection properties fixed my issue.
https://godzillai5.wordpress.com/2016/08/21/jdbc-jt400-setting-to-get-crud-and-show-sql-features-added-in-netbeans-with-ibm-db2-for-i/
The IBM documentation here http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzahh/jdbcproperties.htm
"extended metadata"
Specifies whether the driver requests extended metadata from the
server. Setting this property to true increases the accuracy of the
information returned from the following ResultSetMetaData methods:
getColumnLabel(int) isReadOnly(int) isSearchable(int) isWriteable(int)
apparently readonly for the result set is incorrectly assumed true, unless the ext. metadata comes back with the actual value for isReadOnly(int). I'm guessing that its assumed false because on the initial connection the connection property "Read Only" is true. It would be helpful to understand what setting on the system or the Library/Schema is causing the connection to have that property.
The most obvious reason for the original image showing just some read-only operations presented, would seem to have been the "access" attribute for the connection; i.e. if set to "read only", that would limit access to SELECT statements only. But with the new information showing the connection properties, seems the readOnly=false, so that "access" attribute should not be the origin for the issue.
I suspect that for any given TABLE, the issue might be for lack of a PRIMARY KEY CONSTRAINT; i.e. IIRC, some client database applications might prevent update-capable mode for a particular TABLE, if that TABLE is not known to have a PK.
I would like to set the cache database used with Microsoft Code Contracts to use a LocalDB instance where the MDF is not located at the default data location. (For the sake of this question I am not interested in changing the LocalDB behavior through registry settings.)
Normally the database file can be specified in a Connection String and specifying the MDF path.
However, the poorly documented "SQL Server Field" in the Code Contracts project setting tab only seems to accept a SQL Server instance - eg. (LocalDB)\v11 - and not a connection string making it a very large hammer.
When I try to specify a Connection String (eg. "Data Source=..") in the field, I get an error such as
Cannot load assembly 'Source=(LocalDB)\v11.0;Initial'
which makes me believe this field does alot more than it indicates.
How are such "advanced scenarios" specified/handled for a Code Contract cache?
(My case involves the desire to choose the MDF path: but what about credentials? or a different database within the same instance?)
How does one set the schema for HSQLDB in the JDBC URL itself.
Kinda how you can do in MySQL with jdbc:mysql://localhost:3306/
-EDIT-
My current DB url looks like this
jdbc:hsqldb:file:C:\\hsqldb\\dbname
Also inside the dbanme there is a schema newSchema, which can be set using
set schema newSchema,
how do i do this using the jdbc URL itself.
have you already tried the standard protocol?
"jdbc:hsqldb:hsql://[HOST]:[PORT]/myDBName"
How are you trying to connect? through a standalone app or by creating a resource?
You might have seen this but still check here if not done:
http://hsqldb.org/doc/2.0/guide/dbproperties-chapt.html#dpc_connection_url
I think need to specify the port number like as shown //192.0.0.10:9500
UPDATE:
I have been doing some more testing. The suggested solution appears to be ineffective.
For example; if I set the schema to Test I still may not use SQL on tables in that schema. Essentially that extra stuff I put in there has no effect, even though I thought it was OK.
select * from BOOKMARKS;
SEVERE SQL Error at '<stdin>' line 5:
"select * from BOOKMARKS"
user lacks privilege or object not found: BOOKMARKS
SquirrelSQL has an option for an initial schema, so queries there work OK. The sqlTool accepts the URI but doesn't change/select the schema. It is slightly frustrating that I can't see HOW to report the current schema name in use btw.
So this answer doesn't solve the problem; I'm leaving it here because it will save the next person time when they find a good answer to the challenge.
back to the drawing board ...
original suggestion ...
I'd like to do this too. For example with mysql the example is:
mysql -h hostname:port schema
The port number, being one port per database. Now in HSQLDB, the URL is one database within a Catalog (that's how they spell it). Here's the solution I came-up with. I have ...
databsee: dev
schemas
public
test
In my RC file, ~/.config/sqltool.rc ...
urlid dev_test
url jdbc:hsqldb:hsql://localhost/dev;set schema test;
username programmer
password secret
I can use the connection ID dev_test to link to the test schema, the normal default is public. And you can run the sql tool with:
java -jar /usr/lib/hsqldb/lib/sqltool.jar --rcFile=~/.config/sqltool.rc dev_tmp
That approach worked with a Groovy Sql connection:
url: 'jdbc:hsqldb:hsql://localhost/dev;set schema test',
...
Worked just how I'd want it. So what I can do is append the schema I want to that URL connection string string. It may no be the solution but it will do what you describe.
Looking at the connection protocol: there is NO option for a schema nor for a catalog. So catalog will be part of your URL, eg. if you use a file base database, that is one catalog.
We have a requirement to make our products work on Oracle as well as SQL Server (around which they were originally built). Unfortunately we don't have any in house Oracle development experience to speak of but as a senior dev it has fallen to me to lead the project. So far I have managed to make our app connect to an Oracle database (I'm using Oracle XE 11.2) by using the following connection string:
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=VS010-ORA11GR1)(PORT=1523))(CONNECT_DATA=(SERVICE_NAME=DEVORA)));User Id=dbo;Password=dbo;
The reason we decided to use this type of connection string is because we do not want to rely on changing tnsnames.ora on every client machine. However, as you can see this specifies an Oracle user and associated password. We also need to provide the ability to use the equivalent of SQL Server integrated security.
According to the literature I have read, to do this I simply need to specify / as the user id and then omit the password portion (as this is ignored anyway for Windows authentication). I also created the user in Oracle, making sure it matched the Windows user, with the following snippets:
CREATE USER "OPS$<DOMAIN>\<user>" IDENTIFIED EXTERNALLY;
GRANT CONNECT,RESOURCE TO "OPS$<DOMAIN>\<user>";
I also checked that the sqlnet.ora file on my local machine which hosts the XE instance and my dev environment contained the line:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
I understood that this would enable my app to connect to the Oracle database uing Windows Authentication. However what actually happens is that I get the following Oracle error message:
ORA-01005: null password given; logon denied
this doesn't make much sense because of course its null - it's supposed to be, according to the tutorials I've read.
The app targets .Net Framework 3.5, we are using the System.Data.OracleProvider and the actual connecting and so on is handled by Enterprise Library 5. Incidentally, I am aware of the deprecation of the OracleClient component but I just want this to work before I go into the extra complexities of changing providers.
Can anyone tell me what I'm missing? Have I chosen the wrong type of connection string? I apologise for any basic mistakes but I have always managed to avoid Oracle until now so my knowledge of it is close to zero.
Many thanks
I had the same problem and solved after adding this to conn. string:
Integrated Security=yes
To expand on the answer above by #Stikut. I tested this out with NHibernate 3.3.3.GA and it works.
user id=/;password=;Integrated Security=yes