问题
I have installed DB2 Express C 9.7.4 edition.
I am establishing DB2 Connection using JAVA language.
But I have to still provide user name and password of my windows Login account for establishing connection...
Is it necessary to mention it ?
Is there any way out that can establish connection without specifying user name/password as during installation we have skipped the page.
Thanks in advance...
回答1:
When an application runs on the same machine as the database server, DB2 will make the assumption that the userID that started the application has already been authenticated by the operating system – so no additional authentication is necessary. This is referred to as impicit authentication.
So, without making changes to the default DB2 database configuration, you can do this if the following conditions are met:
The java application must be running on the same machine as the DB2 database
Your application must use a JDBC Type 2 connection (JDBC URL should look like
jdbc:db2:database– notjdbc://localhost:50000/database).The userID executing the Java application has authority to connect to the DB2 database, query the appropriate tables, etc.
It is possible to allow implicit authentication for applications running on machines other than the database server, but this requries setting up trusted contexts or opening a big security hole (changing the AUTHENTICATION database configuration parameter).
回答2:
The option that you mention in the screenshot is just to indicate the way the instance and other services are started. It does not mean the authentication mechanism used in DB2.
In order to permit an unknown user to connect to the database, you have to grant "connection" to public group. By doing this, any user could connect to the database, and it is not necessary to give the credentials.
db2 GRANT CONNECT ON DATABASE TO PUBLIC
For more information: http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0050616.html
来源:https://stackoverflow.com/questions/8291677/db2-connection-without-specifying-username-and-password