10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have a small bash script which I want to run on an Amazon EC2 Ubuntu instance for setting up a postgreSQL database:
#!/bin/bash
USERNAME='postgres'
start=$SECONDS
TMP_DIR=/local/test/4g4d
PORT=23456
rm -rf $TMP_DIR/db
mkdir -p $TMP_DIR/
echo "creating database..."... (3 Replies)
Discussion started by: Helveticus
3 Replies
2. High Performance Computing
I am managing a linux cluster which has been build on Platform Cluster Manager PCM 1.2.1) from IBM Platform Computing. Unfortunately somebody deteled data files of postgresql from /var/lib directory. I somehow managed to start the postmaster service again, but all the administrative commands of... (2 Replies)
Discussion started by: ahsanpmd
2 Replies
3. Shell Programming and Scripting
Hi All,
I am newbie to unix shell scripting. I want to connect to oracle database using shell script. I know how to connect DB using user name and password but my question is if my password is having '@' sign then how to connect.
I have tried like below,
cnt=`sqlplus -s /nolog << EOFSQL
... (3 Replies)
Discussion started by: pmotewar
3 Replies
4. Shell Programming and Scripting
Hi Unix Gurus,
I have a requirement to write a script, Oracle DB gets referesh every 6hrs, hence we need write a script to connect to the database , if it connects it should generate a file to proceed the next job application or when an error when connectiong to DB it should not generate any... (8 Replies)
Discussion started by: bshivali
8 Replies
5. Shell Programming and Scripting
I've been sent the following script to finish. It's supposed to connect to an oracle database, query it, and send an email if the query result value is one or more. Currently it isn't connecting properly, just giving the following error:
ERROR: ORA-01017: invalid username/password; logon denied... (2 Replies)
Discussion started by: jackmorgan2007
2 Replies
6. Shell Programming and Scripting
How to connect to SQL Server database from perl script using JDBC driver?
---------- Post updated at 05:33 PM ---------- Previous update was at 05:07 PM ----------
i have sqljdbc.jar file. by setting the class path how can i connect to the database using perl script? (2 Replies)
Discussion started by: laknar
2 Replies
7. Shell Programming and Scripting
I have got the solution so just closing this issue. (3 Replies)
Discussion started by: jambesh
3 Replies
8. Shell Programming and Scripting
I am trying to connect to database db2 through shell script.
The process I am trying is
> db2
It gives me error Access Denied.
While checking for access I have the rights.
Is there ant other way round..?
Please help. (3 Replies)
Discussion started by: ankitgupta
3 Replies
9. Shell Programming and Scripting
Hi,
could you please help me out what are the command line commands to connect to as400.
Thanks, (0 Replies)
Discussion started by: mgirinath
0 Replies
10. Shell Programming and Scripting
Hi,
Can anyone please give me a script or let me know how to connect to a sybase database and execute a query using Korn shell scripts.Am new to Unix but i need to do this ASAP.
Please help.
Thanks,
Gops (7 Replies)
Discussion started by: bhgopi
7 Replies
PG_ESCAPE_STRING(3) PG_ESCAPE_STRING(3)
pg_escape_string - Escape a string for query
SYNOPSIS
string pg_escape_string ([resource $connection], string $data)
DESCRIPTION
pg_escape_string(3) escapes a string for querying the database. It returns an escaped string in the PostgreSQL format without quotes.
pg_escape_literal(3) is more preferred way to escape SQL parameters for PostgreSQL. addslashes(3) must not be used with PostgreSQL. If the
type of the column is bytea, pg_escape_bytea(3) must be used instead. pg_escape_identifier(3) must be used to escape identifiers (e.g. ta-
ble names, field names)
Note
This function requires PostgreSQL 7.2 or later.
PARAMETERS
o $connection
- PostgreSQL database connection resource. When $connection is not present, the default connection is used. The default connection
is the last connection made by pg_connect(3) or pg_pconnect(3).
o $data
- A string containing text to be escaped.
RETURN VALUES
A string containing the escaped data.
CHANGELOG
+--------+-------------------+
|Version | |
| | |
| | Description |
| | |
+--------+-------------------+
| 5.2.0 | |
| | |
| | $connection added |
| | |
+--------+-------------------+
EXAMPLES
Example #1
pg_escape_string(3) example
<?php
// Connect to the database
$dbconn = pg_connect('dbname=foo');
// Read in a text file (containing apostrophes and backslashes)
$data = file_get_contents('letter.txt');
// Escape the text data
$escaped = pg_escape_string($data);
// Insert it into the database
pg_query("INSERT INTO correspondence (name, data) VALUES ('My letter', '{$escaped}')");
?>
SEE ALSO
pg_escape_bytea(3).
PHP Documentation Group PG_ESCAPE_STRING(3)