Thread: PostgreSQL and WWW
Greetings, great thanks to Oleg Broytmann for his useful advice, I've understood the proper fromat for input data at last and the problem with copying DB from file was successfully solved. Well, I hope you will not be angry with me for one more (and I want belive the last) lame question: how do I make my DB accessible from the Web (via JDBC)? With what parameters should I call 'Class.forName()' and 'DriverManager.getConnection()' in case of PostgreSQL? I must notice that I'm going to write a servlet, but not an applet. P.S.: you can write me in russian - it's my native lang. :) P.P.S.: database name is 'rscexamdb', table name is 'exam', may be it should be useful for examples. -- BEST WISHES, Mitlas Webmaster, Auric Vision Ltd. http://www.auricvision.com/
Dmitry Iv Popov <mitlas@auricvision.com> wrote: > how do I make my DB accessible from the Web (via JDBC)? With what > parameters should I call 'Class.forName()' and > 'DriverManager.getConnection()' in case of PostgreSQL? The following is quoted from ".../pgsql/src/interfaces/jdbc/example/basic.java": // Load the driver Class.forName("postgresql.Driver"); // Connect to database System.out.println("Connecting to Database URL = " + url); db = DriverManager.getConnection(url, usr, pwd); `url' could be "localhost:postgresql:rscexamdb", e.g. If your program can't find the driver class, you maybe have forgotten to put it into the CLASSPATH: declare -x CLASSPATH=$CLASSPATH:./:/usr/local/lib/java/postgresql.jar (or equivalents, depends on your shell; valid only, if file "postgresql.jar" is in "/usr/local/lib/java", of course). In the jdbc driver directory (".../src/interfaces/jdbc", see above) you'll find a README telling you something about building, installing and using the driver. Hope it helps, Ulf P.S.: > P.S.: you can write me in russian - it's my native lang. :) unfortunately not mine ;-) -- ====================================================================== %%%%% Ulf Mehlig <umehlig@zmt.uni-bremen.de> %%%%!%%% Projekt "MADAM" <umehlig@uni-bremen.de> %%%% %!% %%%% ---------------------------------------------------- ---| %%% MADAM: MAngrove | Center for Tropical Marine ||--%!% Dynamics | Biology || And | Fahrenheitstrasse 1 _ /||\_/\_ Management | / / \ \ ~~~~~~~~~~~~~~~~~ | 28359 Bremen/Germany ~~~~~~~~~~~~~~~~~~~~
On Sat, 28 Nov 1998, Dmitry Iv Popov wrote: > Greetings, > > great thanks to Oleg Broytmann for his useful advice, I've > understood the proper fromat for input data at last and the > problem with copying DB from file was successfully solved. > > Well, I hope you will not be angry with me for one more > (and I want belive the last) lame question: how do I make my > DB accessible from the Web (via JDBC)? With what parameters > should I call 'Class.forName()' and > 'DriverManager.getConnection()' in case of PostgreSQL? Connection con = DriverManager.getConnection("jdbc:postgresql:rscexamdb","username","password"); > I must notice that I'm going to write a servlet, but not an > applet. It works best with servlet's and applications, but (personally) it's not that good for applets. For applets, it would be better to have your own protocol to a servlet, then jdbc to the database. -- Peter T Mount peter@retep.org.uk Main Homepage: http://www.retep.org.uk PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres Java PDF Generator: http://www.retep.org.uk/pdf