Re: Problem with Postgresql JDBC driver

2001-06-18 Thread Luba Powell

<< you need to add the shutdown-hooks permission>>
Yes, this too.  You can either update policy file directly or via
GUI jdk1.3\bin\policytool
 you need to add the
shutdown-hooks permission.




- Original Message -
From: "David Wall" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 18, 2001 12:08 PM
Subject: Re: Problem with Postgresql JDBC driver


> Rather a postgresq question.  I don't know what the error was, but you
want
> to make sure the postgresql.jar file is in your webapp/my_app/WEB-INF/lib
> directory.  And if you are using a security manager, you need to add the
> shutdown-hooks permission.
>
> David
>
>




Re: Problem with Postgresql JDBC driver

2001-06-18 Thread David Wall

Rather a postgresq question.  I don't know what the error was, but you want
to make sure the postgresql.jar file is in your webapp/my_app/WEB-INF/lib
directory.  And if you are using a security manager, you need to add the
shutdown-hooks permission.

David





Re: Problem with Postgresql JDBC driver

2001-06-18 Thread Luba Powell

Ryszad:
   Please let me know if this works for you:

Driver driver =
(Driver) Class.forName("driver URL").newInstance();

This part of statement that you already had in your program:
(Driver) Class.forName("driver URL")

will load .class file into memory.

It is .newInstance() that will actually create and instance of Driver class.

Also make sure your URL is correct.






- Original Message -
From: "Luba Powell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 18, 2001 10:46 AM
Subject: Re: Problem with Postgresql JDBC driver


> Try this:
>
> Driver driver =
> (Driver) Class.forName("driver URL").newInstance();
> if (driver == null)
> {
> System.out.println("no driver found");
> }
>
>
> - Original Message -
> From: "Ryszard Lach" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, June 18, 2001 6:40 AM
> Subject: Problem with Postgresql JDBC driver
>
>
> > Hi!
> >
> > I have serious problem with JDBC driver for postgresql. I'm using tomcat
> 3.2.2
> > with jdk1.3.1 (I've tried 1.2.2 too). I've tried to put jdbc7.0-1.2.jar
> into:
> >
> > $TOMCAT_HOME/lib
> > $TOMCAT_HOME/webapp/my_app/WEB-INF/lib
> >
> > and unpacked jdbc7.0-1.2.jar into
> >
> > $TOMCAT_HOME/classes
> > $TOMCAT_HOME/webapp/my_app/WEB-INF/classes
> >
> > and I still receive an error (included at bottom of the message) while
> calling
> > Class.forName("postgresql.Driver") in a .jsp file located in
> .../webapp/my_app
> > directory.
> >
> >
> > I'm sure that classpath containing jdbc.*.jar is used by tomcat's
startup
> > script, but it seems I'm missing something...
> >
> > What could be wrong ? Do I have to configure workers or webapps in any
> special
> > way?
> >
> > Any help would be very appreciated.
> >
> > This is the error I receive:
> >
> > Error: 500
> >
> > Location: /test_pgsql.jsp
> >
> > Internal Servlet Error:
> >
> > javax.servlet.ServletException: No suitable driver
> > at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
> l.java, Compiled Code)
> > at
>
_0002ftest_0005fpgsql_0002ejsptest_0005fpgsql_jsp_1._jspService(_0002ftest_0
> 005fpgsql_0002ejsptest_0005fpgsql_jsp_1.java, Compiled Code)
> > at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java,
> Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java,
> Compiled
> > Code)
> > at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
> va, Compiled Code)
> > at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java,
> Compiled Code)
> > at org.apache.jasper.servlet.JspServlet.service(JspServlet.java,
> Compiled Code)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java,
> Compiled Code)
> > at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java,
> Compiled Code)
> > at org.apache.tomcat.core.Handler.service(Handler.java, Compiled
> Code)
> > at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java,
Compiled
> Code)
> > at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java,
> Compiled Code)
> > at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java,
Compiled
> Code)
> > at
>
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java, Compiled Code)
> > at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
> Compiled Code)
> > at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
> Compiled Code)
> > at java.lang.Thread.run(Thread.java, Compiled Code)
> >
> > Root cause:
> >
> > java.sql.SQLException: No suitable driver
> > at java.sql.DriverManager.getConnection(DriverManager.java,
> Compiled Code)
> > at java.sql.DriverManager.getConnection(DriverManager.java,
> Compiled Code)
> > at
>
_0002ftest_0005fpgsql_0002ejsptest_0005fpgsql_jsp_1._jspService(_0002ftest_0
> 005fpgsql_0002ejsptest_0005fpgsql_jsp_1.java, Compiled Code)
> > at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java,
> Compiled Code)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java,
> Compiled Code)
> > at
>
org.apache.ja

Re: Problem with Postgresql JDBC driver

2001-06-18 Thread Ryszard Lach

On Mon, Jun 18, 2001 at 10:05:16AM -0400, Jeff Waugh wrote:
> Sorry, I hadn't read your error message closely enough.
> 
> 'No suitable driver' usually means a problem with the database
> URL to which you are trying to connect.
> 
> That should look something like:
> 
> db = DriverManager.getConnection("jdbc:postgresql://hostname/dbname",
> "username", "password");
> 
> Try playing with that.

Well, now it works. It seems you were right. I can not connect using
DriverManager, but the following code works pretty fine:

Driver drv = new org.postgresql.Driver();
Properties p = new Properties();
p.put("user","my_username");
p.put("password","my_password");
Connection con = drv.connect("jdbc:postgresql://localhost:5432/testowa",p);

Thanks all of you for your help.

Best regards,

R.

-- 
** Internet Designers S.A., ul. Przedmiejska 6--10, 54-201 Wrocław **
 tel. (071) 35 00 445 w. 25; fax (071) 37 35 946; http://www.id.pl/



Re: Problem with Postgresql JDBC driver

2001-06-18 Thread Luba Powell

Try this:

Driver driver =
(Driver) Class.forName("driver URL").newInstance();
if (driver == null)
{
System.out.println("no driver found");
}


- Original Message -
From: "Ryszard Lach" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 18, 2001 6:40 AM
Subject: Problem with Postgresql JDBC driver


> Hi!
>
> I have serious problem with JDBC driver for postgresql. I'm using tomcat
3.2.2
> with jdk1.3.1 (I've tried 1.2.2 too). I've tried to put jdbc7.0-1.2.jar
into:
>
> $TOMCAT_HOME/lib
> $TOMCAT_HOME/webapp/my_app/WEB-INF/lib
>
> and unpacked jdbc7.0-1.2.jar into
>
> $TOMCAT_HOME/classes
> $TOMCAT_HOME/webapp/my_app/WEB-INF/classes
>
> and I still receive an error (included at bottom of the message) while
calling
> Class.forName("postgresql.Driver") in a .jsp file located in
.../webapp/my_app
> directory.
>
>
> I'm sure that classpath containing jdbc.*.jar is used by tomcat's startup
> script, but it seems I'm missing something...
>
> What could be wrong ? Do I have to configure workers or webapps in any
special
> way?
>
> Any help would be very appreciated.
>
> This is the error I receive:
>
> Error: 500
>
> Location: /test_pgsql.jsp
>
> Internal Servlet Error:
>
> javax.servlet.ServletException: No suitable driver
> at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java, Compiled Code)
> at
_0002ftest_0005fpgsql_0002ejsptest_0005fpgsql_jsp_1._jspService(_0002ftest_0
005fpgsql_0002ejsptest_0005fpgsql_jsp_1.java, Compiled Code)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java,
Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java,
Compiled
> Code)
> at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va, Compiled Code)
> at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java,
Compiled Code)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java,
Compiled Code)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java,
Compiled Code)
> at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java,
Compiled Code)
> at org.apache.tomcat.core.Handler.service(Handler.java, Compiled
Code)
> at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java, Compiled
Code)
> at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java,
Compiled Code)
> at
org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled
Code)
> at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java, Compiled Code)
> at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
> at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
Compiled Code)
> at java.lang.Thread.run(Thread.java, Compiled Code)
>
> Root cause:
>
> java.sql.SQLException: No suitable driver
> at java.sql.DriverManager.getConnection(DriverManager.java,
Compiled Code)
> at java.sql.DriverManager.getConnection(DriverManager.java,
Compiled Code)
> at
_0002ftest_0005fpgsql_0002ejsptest_0005fpgsql_jsp_1._jspService(_0002ftest_0
005fpgsql_0002ejsptest_0005fpgsql_jsp_1.java, Compiled Code)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java,
Compiled Code)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java,
Compiled Code)
> at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va, Compiled Code)
> at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java,
Compiled Code)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java,
Compiled Code)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java,
Compiled Code)
> at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java,
Compiled Code)
> at org.apache.tomcat.core.Handler.service(Handler.java, Compiled
Code)
> at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java, Compiled
Code)
> at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java,
Compiled Code)
> at
org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled
Code)
> at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java, Compiled Code)
> at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
> at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
Compiled Code)
> at java.lang.Thread.run(Thread.java, Compiled Code)
>
>
> --
> ** Internet Designers S.A., ul. Przedmiejska 6--10, 54-201 Wrocław **
>  tel. (071) 35 00 445 w. 25; fax (071) 37 35 946; http://www.id.pl/




Re: Problem with Postgresql JDBC driver

2001-06-18 Thread Jeff Waugh

Sorry, I hadn't read your error message closely enough.

'No suitable driver' usually means a problem with the database
URL to which you are trying to connect.

That should look something like:

db = DriverManager.getConnection("jdbc:postgresql://hostname/dbname",
"username", "password");

Try playing with that.

-Jeff

- Original Message -
From: "Ryszard Lach" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 18, 2001 7:20 AM
Subject: Re: Problem with Postgresql JDBC driver


> On Mon, Jun 18, 2001 at 07:21:21AM -0400, Jeff Waugh wrote:
> > Try Class.forName("org.postgresql.Driver")...
>
> Doesn't work too.
>
> R.
>
> --
> ** Internet Designers S.A., ul. Przedmiejska 6--10, 54-201 Wrocław **
>  tel. (071) 35 00 445 w. 25; fax (071) 37 35 946; http://www.id.pl/
>




Re: Problem with Postgresql JDBC driver

2001-06-18 Thread Ryszard Lach

On Mon, Jun 18, 2001 at 12:52:56PM +0200, Tim Stoop wrote:
> Ryszard Lach wrote:
> > 
> > and I still receive an error (included at bottom of the message) while calling
> > Class.forName("postgresql.Driver") in a .jsp file located in .../webapp/my_app
> > directory.
> 
> Try not using the DriverManager, like so:
> 
> Driver drv = org.postgresql.Driver;
> Connection conn = drv.connect("jdbc:postgresql:localhost", "username",
> "password");
> 
> Worked for me (although you should look for the exact connect-method,
> I'm not very sure about this one).
> 

The effect is the same. I forgott to write, that normal (java) program using 
this driver works fine. I've checked also whether java executable
($JAVA_HOME/bin/java) opens apropriate files (using unix strace command) and I
found it doaes.

Do you have any other suggestions ? 

R.

-- 
** Internet Designers S.A., ul. Przedmiejska 6--10, 54-201 Wrocław **
 tel. (071) 35 00 445 w. 25; fax (071) 37 35 946; http://www.id.pl/



Re: Problem with Postgresql JDBC driver

2001-06-18 Thread Ryszard Lach

On Mon, Jun 18, 2001 at 07:21:21AM -0400, Jeff Waugh wrote:
> Try Class.forName("org.postgresql.Driver")...

Doesn't work too.

R.

-- 
** Internet Designers S.A., ul. Przedmiejska 6--10, 54-201 Wrocław **
 tel. (071) 35 00 445 w. 25; fax (071) 37 35 946; http://www.id.pl/



Re: Problem with Postgresql JDBC driver

2001-06-18 Thread Jeff Waugh

Try Class.forName("org.postgresql.Driver")...

- Original Message -
From: "Ryszard Lach" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 18, 2001 6:40 AM
Subject: Problem with Postgresql JDBC driver


> Class.forName("postgresql.Driver") in a .jsp file located in
.../webapp/my_app





Re: Problem with Postgresql JDBC driver

2001-06-18 Thread Tim Stoop

Ryszard Lach wrote:
> 
> and I still receive an error (included at bottom of the message) while calling
> Class.forName("postgresql.Driver") in a .jsp file located in .../webapp/my_app
> directory.

Try not using the DriverManager, like so:

Driver drv = org.postgresql.Driver;
Connection conn = drv.connect("jdbc:postgresql:localhost", "username",
"password");

Worked for me (although you should look for the exact connect-method,
I'm not very sure about this one).

Kind regards,
Tim Stoop