Home > Net >  PostgreSql Equivalent of sqlplus -S username/password \@lock?
PostgreSql Equivalent of sqlplus -S username/password \@lock?

Time:05-12

What will be Postgres equivalent of following:

sqlplus -S username/password \@lock.

Also what does @lock means here?

CodePudding user response:

I don't know PostgreSQL, but - as of Oracle, here you are:

That command means that

  • you'll connect to Oracle's command line tool called SQL*Plus (executable name is sqlplus)
  • in silent mode (that's what -s does)
  • providing username and password
  • and execute .SQL script whose name is lock (I have no idea what it does; you'll have to open it in any text editor and have a look)

Now, how someone establishes connection to PostgreSQL and runs a .SQL script, that's something I wouldn't know, but - reading online documentation - it might be

psql -U username -d database_name -a -f lock

CodePudding user response:

According to the explanations in the comments and the other answer, the equivalent in PostgreSQL should be

psql 'user=username password=password dbname=mydatabase' -f lock
  • Related