Oracle Sqldeveloper : command line "Connection Name" creation - oracle-sqldeveloper

Can you please help me to create "Connection Name" using command line for SQL developer. I am looking for command to create connection name

Related

SQL Shell (psql) don't run any commands on Windows [duplicate]

I'm new to Postgres and I set up a database and table. On the Ubuntu 18.04 command line (on a cloud server) I issued the following command using psql:
INSERT INTO psq01(date, email, firstname, lastname, password, comments)
VALUES ("052419", "mjs#outlook.com", "John", "Smith", "blank", "No comment")
After I issue that command, the psql command prompt switches from =# to -#, which means the transaction is not finished, so I issued COMMIT, but the prompt still shows as -#.
My question is: what do I do after an insert into command? Why am I getting the -# prompt?
The dbname-# prompt means that psql is waiting for a continuation line because you haven't terminated the statement with a semiculon (;) yet.
Either type a single semicolon and Enter to finish the command or type Ctrl+C to interrupt it and start over.
Are you sure that you want to use a superuser for inserting into a table?

Change ODBC in command line (Win. 7)

I have a set of ODBCs that have to be changed each time I move a computer from one domain to the other. I have move a bunch of them so I am looking for a way to do this with command line to save time. If you know any faster ways of doing this I am open to this also.
You can change from cmd as below.
odbcconf configsysdsn "MySQL ODBC 5.2w Driver"
"DSN=test;SERVER=127.0.0.1;PORT=3306;DATABASE=mdb;UID=root 
Reference: Install An ODBC connection from cmd line

PostgreSQL installation - error loading modules

I haven't been able to re-install PostgreSQL + PostGIS properly on our virtual server.
Installing PostgreSQL the following error occurs about the end of the process:
"A non-fatal error occurred whilst loading database modules. Please check the installation log in C:...\Temp for details."
Here is what the log says:
Loading additional SQL modules...
Executing cscript //NoLogo "C:\Programme\PostgreSQL\9.0\installer\server\loadmodules.vbs" "postgres" "****" "C:\Programme\PostgreSQL\9.0" "C:\Programme\PostgreSQL\9.0\data" 5432
Script exit code: 2
Script output:
Installing the adminpack module in the postgres database...
Executing 'C:\DOKUME~1\Kiesow\LOKALE~1\Temp\rad3C00F.bat'...
Couldn't find the output file...
Failed to install the 'adminpack' module in the 'postgres' database
loadmodules.vbs ran to completion
Script stderr:
Program ended with an error exit code
Error running cscript //NoLogo "C:\Programme\PostgreSQL\9.0\installer\server\loadmodules.vbs" "postgres" "****" "C:\Programme\PostgreSQL\9.0" "C:\Programme\PostgreSQL\9.0\data" 5432 : Program ended with an error exit code
Afterwards installation completes, I can start pgAdmin, log in and create new databases. Everything looks fine until I try to add PostGIS, using the stack builder wizard. Again the installation is almost finished, when:
"Database creation failed."
"Would you like to view the error log " "create_templatepostgis_db_error.txt'?"
This error log doesn't exist. I might ignore the error and create the template db manually, which works. But I cannot use types like 'geometry', so I think, PostGIS is not yet usable.
Maybe anyone of you has got an idea of what I could have done wrong? Any hints? Can anybody help me to interpret the error log?
I use Windows XP, PostgreSQL 9.0 32bit (same with 8.4), PostGIS 1.5.
Postgres 8.3 + PostGIS was installed on this system earlier, but I uninstalled, deleted the data directory and let the installation wizard create a new posgres windows user.
Did a few reboots, too.
And I did choose a locale instead of [Default locale] at Postgres installation.
This is another part of the log I am suspicios of. It is right in the beginning. Maybe this helps:
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-9.0 Data Directory. Setting variable iDataDirectory to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-9.0 Base Directory. Setting variable iBaseDirectory to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-9.0 Service ID. Setting variable iServiceName to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-9.0 Service Account. Setting variable iServiceAccount to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-9.0 Super User. Setting variable iSuperuser to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-9.0 Branding. Setting variable iBranding to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-9.0 Version. Setting variable brandingVer to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-9.0 Shortcuts. Setting variable iShortcut to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-9.0 DisableStackBuilder. Setting variable iDisableStackBuilder to empty value
[15:44:31] Existing base directory:
[15:44:31] Existing data directory:
[15:44:31] Using branding: PostgreSQL 9.0
[15:44:31] Using Super User: postgres and Service Account: postgres
[15:44:31] Using Service Name: postgresql-9.0
Executing cscript //NoLogo "C:\Dokumente und Einstellungen\Kiesow\Lokale Einstellungen\Temp\prerun_checks.vbs"
Script exit code: 0
Script output:
The scripting host appears to be functional.
Script stderr:
Executing cscript //NoLogo "C:\Dokumente und Einstellungen\Kiesow\Lokale Einstellungen\Temp\postgresql_installer\installruntimes.vbs" "C:\Dokumente und Einstellungen\Kiesow\Lokale Einstellungen\Temp\postgresql_installer\vcredist_x86.exe"
Script exit code: 3010
Script output:
Executing the runtime installer: C:\Dokumente und Einstellungen\Kiesow\Lokale Einstellungen\Temp\postgresql_installer\vcredist_x86.exe
The runtime package exited with error code: 3010
From a command prompt, run this single command:
C:\Programme\PostgreSQL\9.0\bin\psql.exe -p 5432 -U postgres -W -f C:\Programme\PostgreSQL\9.0\share\contrib\adminpack.sql postgres
Its output may be more informative. Running the above is all the .vbs is doing, incidentally.
The reason for prompting this error message was due to because of localhost is pointing to some other machine.
disable firewall and antivirus and try installing it again.

Connecting to Oracle from Perl

I am trying to connect to Oracle using Perl.
I am trying to connect from a Windows XP machine that has Perl installed. I also have downloaded Oracle SQL Developer and Oracle Instant Client. I can connect to the Oracle DB using Oracle SQL Developer using the TNS connection type.
I use the following Perl.
use DBI;
$db=DBI->connect( "dbi:Oracle", "username", "password" ) or die "Can't connect $DBI::errstr\n";
I get the following error message.
DBI connect('','username',...) failed: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID) Check NLS settings etc. at oracle2.pl line3
Cant connect to database ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID) Check NLS settings etc.
Do I need to do anything with Oracle Instant Client because it does not have an installer. Is there something else that needs configured in Perl?
Thank you for any help provided.
* EDIT *
Are there any variables I need to set at the beginning of the Perl to link to either SQL Developer or Instant Client?
I used a different method to connect Perl to an Oracle DB. I used SQLPlus instead of DBI. This is a command line utility from Oracle that can be called from Perl. Below is a sample of my code. The test.sql file can contain one or multiple queries and must end with exit.
my $connect_string = 'username/password#server'; # connection to the DB
my $file = 'test.sql'; # location of SQL file. The file must end with "exit"
my $sqlcmd = "sqlplus -S $connect_string \#$file"; # sqlcommand
system $sqlcmd; # executes command
With that error message and your piece of code, I'd first check whether it helps to explicitely state the Servername in the first parameter of $db=DBI->connect(.. (if need be, google for some examples).
If that doesn't help, I would then check the value of the environmental variable OCI_NLS_CHARSET_ID.
I had the same problem in cygwin and at the end it could be solved.
In my case it turned out (after a lot of investigation and reading) that the root of the problem was with mixing of versions. The server was 11.2 meanwhile I used the 12.1 Instant Client package to build Oracle.dll for DBD::Oracle. So I downloaded the 11.2 version (from Oracle) and this error message just disappeared!
I have read the Trooble Shooting manual, but it seems 3 packages are needed: Basic, SDK and sqlplus (the later is used by the build process to determine the server version).
Before build some bash variables had to be set:
export ORACLE_HOME=/cygdrive/c/install/instantclient_11_2
PATH+=:"$ORACLE_HOME"
export TNS_ADMIN="$HOME"
The later needed to find oci.dll which is referenced by Oracle.dll. This is added to PATH as Windows looks for PATH to find DLLs not LD_LIBRARY_PATH. File tnsnames.ora can be in $TNS_ADMINdir, or in /var/opt/oracle or in /etc (or some other places). The defined service names can be listed by DBI->data_sources('Oracle').
And voilĂ ! I hope this could help!
I wanted to connect to Oracle XE running in a Docker container (with ports 1521 and 5500 mapped to their host equivalents) and query the Oracle sample database. Here's what worked for me.
#!/usr/bin/perl
use DBI;
# connect to Oracle...
$dbh = DBI->connect("dbi:Oracle:localhost/xepdb1","ot","Orcl1234");
# prepare and execute the SQL statement
$sth = $dbh->prepare("SELECT first_name, last_name FROM employees");
$sth->execute;
# retrieve the results
printf "%-30s %-30s\n", "First Name", "Last Name";
while( my $ref = $sth->fetchrow_hashref() ) {
printf "%-30s %-30s\n", $ref->{'FIRST_NAME'}, $ref->{'LAST_NAME'};
}
exit;

how to run db2 sql command from a command line?

how can I run
sql command UPDATE CONTACT
SET EMAIL_ADDRESS = 'mytestaccount#gmail.com'
via command line
for db2 database
on linux
from a shell script file?
You need to be logged into your linux machine with an id that has "db2profile" in it's .profile.
If you are not sure what I'm talking about, look at the .profile of the db2 instance owner (usually db2inst1 unless you changed it during the install). The simplest thing would probably be to log in as the db2 instance owner.
Once you are logged in, type "db2" at the command line. If "db2" is not found, then recheck the .profile stuff.
To execute your sql command type the following at the command line (substitute with the name of the database you want to connect to):
db2 connect to <database name>
db2 UPDATE CONTACT SET EMAIL_ADDRESS = 'mytestaccount#gmail.com'