Thread: from UNIX to postgresql in Linux
Hi, I need some help on how to execute some SQL commands using a java program run in a UNIX server to update postgresql database installed on a Linux workstation. This server and workstation are connected through LAN. I have installed the postgresql with java support (JDBC). I have also define the CLASSPATH variable. $ echo $CLASSPATH /usr/lib/jdk-1.1.6/lib/classes.zip:/usr/local/lib/finder.jar:/usr/local/pgsql/sh are/java/postgresql.jar:.:/opt/IBMJava2-13/javasrc.jar:.:/home/rudy I anc run the program in the Linux workstation but when I try to run it in the UNIX server (HP-UX) there is error : java.lang.ClassNotFoundException: org.postgresql.Driver at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at db.main(db.java:15) part of the program : String url="jdbc:postgresql://"+linuxIPAddress+"/"+databaseName; Class.forName("org.postgresql.driver"); // <- this is the line 15 Connection db=DriverManager.getConnection(url, "user", "password"); Statement a=db.createStatement(); ResultSet rs=a.executeQuery("SELECT * FROM "+tableName); I have installed the database and create the table OK that's all thanks for your help Rudi _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com
Rudianto, change org.postgresql.driver to org.postgresql.Driver Dave On Wed, 2002-08-21 at 23:55, Rudianto Sugiyarto wrote: > Hi, > > I need some help on how to execute some SQL commands using a java program > run in a UNIX server to update postgresql database installed on a Linux > workstation. This server and workstation are connected through LAN. > > I have installed the postgresql with java support (JDBC). I have also define > the CLASSPATH variable. > > $ echo $CLASSPATH > /usr/lib/jdk-1.1.6/lib/classes.zip:/usr/local/lib/finder.jar:/usr/local/pgsql/sh > are/java/postgresql.jar:.:/opt/IBMJava2-13/javasrc.jar:.:/home/rudy > > I anc run the program in the Linux workstation but when I try to run it in > the UNIX server (HP-UX) there is error : > > java.lang.ClassNotFoundException: org.postgresql.Driver > at java.net.URLClassLoader$1.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(Unknown Source) > at java.lang.ClassLoader.loadClass(Unknown Source) > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) > at java.lang.ClassLoader.loadClass(Unknown Source) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Unknown Source) > at db.main(db.java:15) > > part of the program : > > String url="jdbc:postgresql://"+linuxIPAddress+"/"+databaseName; > > Class.forName("org.postgresql.driver"); // <- this is the line 15 > Connection db=DriverManager.getConnection(url, "user", "password"); > > Statement a=db.createStatement(); > > ResultSet rs=a.executeQuery("SELECT * FROM "+tableName); > > I have installed the database and create the table > OK that's all thanks for your help > > Rudi > > > _________________________________________________________________ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > >
Hi Dave, thanks but i 'm sorry that was a typing error when i type this email. On the program i type correctly. So it's still not working hehehe. Thanks very much for your reply Rudi >From: Dave Cramer <Dave@micro-automation.net> >To: Rudianto Sugiyarto <rudi2610@hotmail.com> >CC: "pgsql-jdbc@postgresql.org" <pgsql-jdbc@postgresql.org> >Subject: Re: [JDBC] from UNIX to postgresql in Linux >Date: 22 Aug 2002 00:06:41 -0400 > >Rudianto, > >change org.postgresql.driver to org.postgresql.Driver > >Dave >On Wed, 2002-08-21 at 23:55, Rudianto Sugiyarto wrote: > > Hi, > > > > I need some help on how to execute some SQL commands using a java >program > > run in a UNIX server to update postgresql database installed on a Linux > > workstation. This server and workstation are connected through LAN. > > > > I have installed the postgresql with java support (JDBC). I have also >define > > the CLASSPATH variable. > > > > $ echo $CLASSPATH > > >/usr/lib/jdk-1.1.6/lib/classes.zip:/usr/local/lib/finder.jar:/usr/local/pgsql/sh > > are/java/postgresql.jar:.:/opt/IBMJava2-13/javasrc.jar:.:/home/rudy > > > > I anc run the program in the Linux workstation but when I try to run it >in > > the UNIX server (HP-UX) there is error : > > > > java.lang.ClassNotFoundException: org.postgresql.Driver > > at java.net.URLClassLoader$1.run(Unknown Source) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(Unknown Source) > > at java.lang.ClassLoader.loadClass(Unknown Source) > > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) > > at java.lang.ClassLoader.loadClass(Unknown Source) > > at java.lang.Class.forName0(Native Method) > > at java.lang.Class.forName(Unknown Source) > > at db.main(db.java:15) > > > > part of the program : > > > > String url="jdbc:postgresql://"+linuxIPAddress+"/"+databaseName; > > > > Class.forName("org.postgresql.driver"); // <- this is the line 15 > > Connection db=DriverManager.getConnection(url, "user", "password"); > > > > Statement a=db.createStatement(); > > > > ResultSet rs=a.executeQuery("SELECT * FROM "+tableName); > > > > I have installed the database and create the table > > OK that's all thanks for your help > > > > Rudi > > > > > > _________________________________________________________________ > > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > > > > > > > > >---------------------------(end of broadcast)--------------------------- >TIP 3: if posting/reading through Usenet, please send an appropriate >subscribe-nomail command to majordomo@postgresql.org so that your >message can get through to the mailing list cleanly _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx
Are you sure the jar is where you think it is? Dave On Thu, 2002-08-22 at 00:42, Rudianto Sugiyarto wrote: > Hi Dave, thanks but i 'm sorry that was a typing error when i type this > email. On the program i type correctly. So it's still not working hehehe. > > Thanks very much for your reply > > Rudi > > > >From: Dave Cramer <Dave@micro-automation.net> > >To: Rudianto Sugiyarto <rudi2610@hotmail.com> > >CC: "pgsql-jdbc@postgresql.org" <pgsql-jdbc@postgresql.org> > >Subject: Re: [JDBC] from UNIX to postgresql in Linux > >Date: 22 Aug 2002 00:06:41 -0400 > > > >Rudianto, > > > >change org.postgresql.driver to org.postgresql.Driver > > > >Dave > >On Wed, 2002-08-21 at 23:55, Rudianto Sugiyarto wrote: > > > Hi, > > > > > > I need some help on how to execute some SQL commands using a java > >program > > > run in a UNIX server to update postgresql database installed on a Linux > > > workstation. This server and workstation are connected through LAN. > > > > > > I have installed the postgresql with java support (JDBC). I have also > >define > > > the CLASSPATH variable. > > > > > > $ echo $CLASSPATH > > > > >/usr/lib/jdk-1.1.6/lib/classes.zip:/usr/local/lib/finder.jar:/usr/local/pgsql/sh > > > are/java/postgresql.jar:.:/opt/IBMJava2-13/javasrc.jar:.:/home/rudy > > > > > > I anc run the program in the Linux workstation but when I try to run it > >in > > > the UNIX server (HP-UX) there is error : > > > > > > java.lang.ClassNotFoundException: org.postgresql.Driver > > > at java.net.URLClassLoader$1.run(Unknown Source) > > > at java.security.AccessController.doPrivileged(Native Method) > > > at java.net.URLClassLoader.findClass(Unknown Source) > > > at java.lang.ClassLoader.loadClass(Unknown Source) > > > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) > > > at java.lang.ClassLoader.loadClass(Unknown Source) > > > at java.lang.Class.forName0(Native Method) > > > at java.lang.Class.forName(Unknown Source) > > > at db.main(db.java:15) > > > > > > part of the program : > > > > > > String url="jdbc:postgresql://"+linuxIPAddress+"/"+databaseName; > > > > > > Class.forName("org.postgresql.driver"); // <- this is the line 15 > > > Connection db=DriverManager.getConnection(url, "user", "password"); > > > > > > Statement a=db.createStatement(); > > > > > > ResultSet rs=a.executeQuery("SELECT * FROM "+tableName); > > > > > > I have installed the database and create the table > > > OK that's all thanks for your help > > > > > > Rudi > > > > > > > > > _________________________________________________________________ > > > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 6: Have you searched our list archives? > > > > > > http://archives.postgresql.org > > > > > > > > > > > > > > > >---------------------------(end of broadcast)--------------------------- > >TIP 3: if posting/reading through Usenet, please send an appropriate > >subscribe-nomail command to majordomo@postgresql.org so that your > >message can get through to the mailing list cleanly > > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html > >
are you sure the jar is at where you've declared it? does the jar actually contain the driver? does the jar's file permissions allow for you to read it? also, try declaring your classpath in the command line, i.e. java -classpath ... you can't always trust your env. phil On Thu, 22 Aug 2002, Rudianto Sugiyarto wrote: > Hi Dave, thanks but i 'm sorry that was a typing error when i type this > email. On the program i type correctly. So it's still not working hehehe. > > Thanks very much for your reply > > Rudi > > > >From: Dave Cramer <Dave@micro-automation.net> > >To: Rudianto Sugiyarto <rudi2610@hotmail.com> > >CC: "pgsql-jdbc@postgresql.org" <pgsql-jdbc@postgresql.org> > >Subject: Re: [JDBC] from UNIX to postgresql in Linux > >Date: 22 Aug 2002 00:06:41 -0400 > > > >Rudianto, > > > >change org.postgresql.driver to org.postgresql.Driver > > > >Dave > >On Wed, 2002-08-21 at 23:55, Rudianto Sugiyarto wrote: > > > Hi, > > > > > > I need some help on how to execute some SQL commands using a java > >program > > > run in a UNIX server to update postgresql database installed on a Linux > > > workstation. This server and workstation are connected through LAN. > > > > > > I have installed the postgresql with java support (JDBC). I have also > >define > > > the CLASSPATH variable. > > > > > > $ echo $CLASSPATH > > > > >/usr/lib/jdk-1.1.6/lib/classes.zip:/usr/local/lib/finder.jar:/usr/local/pgsql/sh > > > are/java/postgresql.jar:.:/opt/IBMJava2-13/javasrc.jar:.:/home/rudy > > > > > > I anc run the program in the Linux workstation but when I try to run it > >in > > > the UNIX server (HP-UX) there is error : > > > > > > java.lang.ClassNotFoundException: org.postgresql.Driver > > > at java.net.URLClassLoader$1.run(Unknown Source) > > > at java.security.AccessController.doPrivileged(Native Method) > > > at java.net.URLClassLoader.findClass(Unknown Source) > > > at java.lang.ClassLoader.loadClass(Unknown Source) > > > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) > > > at java.lang.ClassLoader.loadClass(Unknown Source) > > > at java.lang.Class.forName0(Native Method) > > > at java.lang.Class.forName(Unknown Source) > > > at db.main(db.java:15) > > > > > > part of the program : > > > > > > String url="jdbc:postgresql://"+linuxIPAddress+"/"+databaseName; > > > > > > Class.forName("org.postgresql.driver"); // <- this is the line 15 > > > Connection db=DriverManager.getConnection(url, "user", "password"); > > > > > > Statement a=db.createStatement(); > > > > > > ResultSet rs=a.executeQuery("SELECT * FROM "+tableName); > > > > > > I have installed the database and create the table > > > OK that's all thanks for your help > > > > > > Rudi > > > > > > > > > _________________________________________________________________ > > > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 6: Have you searched our list archives? > > > > > > http://archives.postgresql.org > > > > > > > > > > > > > > > >---------------------------(end of broadcast)--------------------------- > >TIP 3: if posting/reading through Usenet, please send an appropriate > >subscribe-nomail command to majordomo@postgresql.org so that your > >message can get through to the mailing list cleanly > > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html >