Thread: Best Practice??
Hi All, I'm realtively new to linux and postgresql. My application gets the following error when it tries to store a record: java.lang.NullPointerException at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125) at java.lang.Thread.run(Thread.java:566) at null.null(Unknown Source) at null.null(Unknown Source) at null.null(Unknown Source) at null.null(Unknown Source) at null.null(Unknown Source) at java.lang.Thread.run(Thread.java:566) ******************************** When I execute the same instruction at the command line it stores it successfully. I'm not sure its related but I wonder if there is something I am doing wrong with setting file permissions. 1. Any idea what's causing this error? 2. What is the Best Practice for setting file ownership and log on for development? I have been doing most of my work logging on as root but I know that is not best. When I changed to another user name I'm afraid it has caused the application to not see the database files or other developed files. Your thoughts would be appreciated, Phil Campaigne
phil campaigne <pcampaigne@charter.net> writes: > I'm realtively new to linux and postgresql. My application gets the > following error when it tries to store a record: > java.lang.NullPointerException If you get no answer here, try pgsql-jdbc. I think most of the folk who read this list aren't big Java users ... regards, tom lane
is there a way to 1. insert a row to table A 2. get the value of the serial field from the now in no.1 3. insert a row to table B (one of the fields uses the value from no.2) in -one transaction-? i'm currently doing it using functions, but is there another way? (kind of like the mysql_insert_id function in mysql) ramil
Ramil, > 1. insert a row to table A > 2. get the value of the serial field from the now in no.1 > 3. insert a row to table B (one of the fields uses the value from no.2) > > in -one transaction-? BEGIN TRANSACTION INSERT INTO table_a ( 2, 3, 4 ) VALUES ( x, y, z ); INSERT INTO table_b ( a_FK, 3, 4 ) VALUES ( CURRVAL('table_a_seq'), m, q ); COMMIT TRANSACTION Easy, neh? Now go to the online docs and do some reading about Sequences. -- Josh Berkus Aglio Database Solutions San Francisco
Hi all, and tx for all the help you give to the community I have a question, really stupid, but i'd like to understand the postgres behavior. I installed dbmirror, and there is a file script creating a table, something like this: CREATE TABLE "MirrorHosts" ..... etc etc Ok, no prob with the syntax (3 years i use postgreSQL), but when i use psql i have this problems: 1) the command \d MirrorHosts doesn't work (table MirrorHost not found), i have to use \d "MirrorHosts" 2) when i do SELECT * FROM MirrorHosts; (the same prob) i have to use "MirrorHosts" I'd like to know if there is a way to bypass this problem. Tx in advance and ..... PostgreSQL is really GREAT! Giorgio Ponza
I believe your problem is simply with the case of the table name. You might want to try \d mirrorhosts. If the table was created "MirrorHosts" (which it looks like it was) postgresql will store that name and you will be required to reference it like that. I believe there is something in the docs about case sensitivity, but I cant seem to find it now. HTH Chad ----- Original Message ----- From: "Giorgio Ponza" <g.ponza@opla.it> To: <pgsql-novice@postgresql.org> Sent: Friday, June 27, 2003 1:37 AM Subject: [NOVICE] Probably a stupid question > Hi all, and tx for all the help you give to the community > I have a question, really stupid, but i'd like to understand the postgres > behavior. > I installed dbmirror, and there is a file script creating a table, something > like this: > CREATE TABLE "MirrorHosts" ..... etc etc > > Ok, no prob with the syntax (3 years i use postgreSQL), but when i use psql > i have this problems: > 1) the command \d MirrorHosts doesn't work (table MirrorHost not found), > i have to use \d "MirrorHosts" > 2) when i do SELECT * FROM MirrorHosts; (the same prob) > i have to use "MirrorHosts" > > I'd like to know if there is a way to bypass this problem. > Tx in advance and ..... PostgreSQL is really GREAT! > > Giorgio Ponza > > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match >