How can I use the stored username and password in Oracle SQL Developer - oracle-sqldeveloper

I have multiple db connections setup in Oracle SQL Developer. Every username and password is stored with the "save Password" option in the Database connection.
I have a script that queries multiple db's.
SELECT * FROM table_on_DB1;
conn username/password#server:1521:DB2
SELECT * FROM table_on_DB2
Running this from the worksheet of DB1 works fine. But the pain is that the username and password are now in the script. I assume there is a way to use the stored username and password from SQL Developer. How can I use the stored username and password from Oracle SQL Developer?

Related

cannot connect to Postgres - password unknown

I can't connect on postgresql.
when i go on pgadmin>server>postgresql, it asked me "please enter the password for the user 'postgres' to connect the server?
I have windows 10 and postgresql 14.
But I don't have this password.
What can I do?
The following worked for me.
Change METHOD of all rows in your pg_hba.conf file from scram-sha-256 to trust (C:\Program Files\PostgreSQL\14\data\pg_hba.conf). This will disable password for your DB.
Click on any database in postgresql to use Query Tool.
In Query Tool type ALTER USER postgres WITH PASSWORD 'User_password';
postgres is default username, execute it.
This way you can set up a password for your DB, after that go back to the first step and change it back from trust to scram-sha-256.

DB2 ODBC password not used

I have a 32-bit DB2 ODBC DSN created with the user name and password saved. But when I try to connect to the DB I have to enter the user name and password again. Is there any way I can bypass the authentication? I have the user name and password saved in db2cli.ini file.
db2 CLP is not a cli application. You can't make it use these UID and PWD cli parameters.

Connecting sqlite database to firebird

Below command used for connecting database through Firebird SQL.
CONNECT "C:\Users\vkaja\Desktop\testing_mysql\newdb.db"
In newdb.db file Schema, data are dumped from SQLite.
Here newdb.db has read-write permission. But error projected here is not a valid username and password.
Statement failed, SQLCODE = -902
Firebird doesn't care about the extension of the database file. fdb is 'standard', and gdb is historical, but it could be anything. However the database you are connecting to must be a Firebird database. You can't just open a database file from a different database system (eg SQLite).
Your problem is one of authentication: you are trying to authenticate without a username + password combination, and if you haven't set the appropriate environment variables, it means Firebird tries to authenticate with an empty user and password, which doesn't exist for your Firebird install. In general you also get this error if you use a username and password that is not known to Firebird.
But even if you fix the authentication problem, you would immediately get a different error: invalid database (or similar), because the file is not a Firebird database.

Postgres: Using dblink to make remote connection

We got a Postgres database credentials (with SSL on) from our contractor, which allow us to connect to the DB using pdAdmin 3. The DB is read-only (can't do pg_dump) to us and basically the contractor will not grant us more privileges.
We need to fetch some data from this remote DB to our local DB. So I wanted to use dblink to perform this task.
I run this on psql:
insert into shifts select * from dblink('hostaddr=remote_addr port=9000 dbname=production user=user password=passwd', 'select user_id, location_id from shifts') as t1(user_id integer, location_id integer);
Then I got:
ERROR: password is required DETAIL: Non-superuser cannot connect if
the server does not request a password. HINT: Target server's
authentication method must be changed.
Since I am new to Postgres and dblink, I have no idea why it is complaining there is no password. And I wonder, to do a dblink connection, does the remote database needs to grant any more privileges?
If the pdAdmin 3 is able to connect to the remote DB with the credentials, what should I do to make dblink work?
Thanks!
Yes only superuser can provide you to the facility to connect through DBLINK
just run this command below whether you are able to connect to database
SELECT dblink_connect('myconn', 'dbname=postgres');
SELECT dblink_connect('myconn', 'hostaddr=remote_addr port=9000 dbname=production user=user password=passwd');
just give the name of database u want to connect after dbname
You can connect
dblink_connect_u
dblink_connect_u() is identical to dblink_connect(), except that it
will allow non-superusers to connect using any authentication method.
Link on postgres site is
dblink
For Superuser ask them to create extension
CREATE EXTENSION dblink;
for your database or schema .

how to create db2 schema with password by command

I am creating db2 schema by using create schema schemaName in mydb database, now while I connect the database by writing connect to mydb user schemaName;
it prompts to give a password.
My question is how to set a password to my existing schema in db2 database
A schema cannot have a password. A user can have a password, but the user does not necessarily match any schema. In DB2 authentication is delegated to the operating system (or other external authority), so you need to use whatever password belongs to the operating system user "schemaName".