pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedpostgresql-8.2-504.jdbc4.jar and backslash
2+ messages / 2 participants
[nested] [flat]
* postgresql-8.2-504.jdbc4.jar and backslash
@ 2007-05-07 06:15 roman <xroot@mail.ru>
2007-05-07 07:20 ` Re: postgresql-8.2-504.jdbc4.jar and backslash Altaf Malik <mmalik_altaf@yahoo.com>
0 siblings, 1 reply; 2+ messages in thread
From: roman @ 2007-05-07 06:15 UTC (permalink / raw)
To: pgsql-jdbc
Hello.
I use this jar driver for connection to postgresql 8.2.3-1 in Windows XP.
In my database I use UFT8 codepage.
I need to save some filepath in some character varying(255) field in table1.
That path looks like this: f:\temp
in String class like this: "f:\\temp";
I try to execute following SQL statement:
UPDATE "table1" SET "field1"='f:\\temp'
in String object it looks like: "UPDATE \"table1\" SET \"field1\"='f:\\temp'".
After statement executed I get on SELECT folowing:
f:<tab symbol>emp
Why? There were two back slashes!!!
When I try to execute that update statement in pgAdminIII everything is OK!!!
Please, help me to decide this problem. How can I save filepath with backslashes?
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: postgresql-8.2-504.jdbc4.jar and backslash
2007-05-07 06:15 postgresql-8.2-504.jdbc4.jar and backslash roman <xroot@mail.ru>
@ 2007-05-07 07:20 ` Altaf Malik <mmalik_altaf@yahoo.com>
0 siblings, 0 replies; 2+ messages in thread
From: Altaf Malik @ 2007-05-07 07:20 UTC (permalink / raw)
To: roman <xroot@mail.ru>; pgsql-jdbc
You are using wrong escape characters. \\ is java escape character, which in turn becomes \ so your String becomes:
UPDATE "table1" SET "field1"='f:\temp'
And when you fetch the data, f:\temp becomes f: emp
because \t is an escape sequence for tab.
Using escape characters, \\ should be written as \\\\ which will convert to \\
--Altaf Malik
roman <xroot@mail.ru> wrote: Hello.
I use this jar driver for connection to postgresql 8.2.3-1 in Windows XP.
In my database I use UFT8 codepage.
I need to save some filepath in some character varying(255) field in table1.
That path looks like this: f:\temp
in String class like this: "f:\\temp";
I try to execute following SQL statement:
UPDATE "table1" SET "field1"='f:\\temp'
in String object it looks like: "UPDATE \"table1\" SET \"field1\"='f:\\temp'".
After statement executed I get on SELECT folowing:
f:<tab symbol>emp
Why? There were two back slashes!!!
When I try to execute that update statement in pgAdminIII everything is OK!!!
Please, help me to decide this problem. How can I save filepath with backslashes?
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
Check outnew cars at Yahoo! Autos.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-05-07 07:20 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-05-07 06:15 postgresql-8.2-504.jdbc4.jar and backslash roman <xroot@mail.ru>
2007-05-07 07:20 ` Altaf Malik <mmalik_altaf@yahoo.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox