From: Eugene <team_pro@gala.net> To: "\"Михаил Дворников\"" <community@altlinux.ru> Subject: Re: [Comm] Java + Postgresql Date: Wed, 18 Jun 2003 09:31:25 +0400 Message-ID: <315207000.20030618093125@gala.net> (raw) In-Reply-To: <E19SV0D-000IcC-00.m_dvor-mail-ru@f25.mail.ru> Hello Михаил, Wednesday, June 18, 2003, 8:56:57 AM, you wrote: МД> Здравствуйте! МД> Дистрибутив Master 2.2. МД> Поставил Java, Postgresql (в том числе postgresql-jdbc). МД> Тестовая программа: МД> import java.sql.*; МД> class Msql { МД> public static void main(String args[]){ try { МД> Class.forName("org.postgresql.Driver"); МД> Connection db = DriverManager.getConnection("jdbc:postgresql:test", "postgres", ""); //на всякий пожарный - "jdbc:postgresql:test", "postgres", "" //на счет строчкий этой... глянь любой пример, как правльно пишется МД> db.close(); } catch (Exception e) { //тут рапортуем об ошибке //Эксепшены можно и по именам отлавливать и обрабатывать - дело //хозяйское..:) } МД> } МД> } МД> К базе test через psql подключался нормально. МД> Выдает ошибки: МД> $javac Msql.java МД> Msql.java:5: unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown МД> Class.forName("org.postgresql.Driver"); МД> ^ Можем не найти класс - получим эксэпшн МД> Msql.java:6: unreported exception java.sql.SQLException; must be caught or declared to be thrown МД> Connection db = DriverManager.getConnection("jdbc:postgresql:test", "postgres", ""); МД> ^ МД> Msql.java:7: unreported exception java.sql.SQLException; must be caught or declared to be thrown МД> db.close(); МД> ^ Могут возникнуть проблеммы с БД - получим эксэпшн МД> 3 errors Ну он же "русским" я зыком просит, чтобы ты вставил try-catch..;) Всего наилучшего. Удачи. -- Best regards, Eugene mailto:team_pro@gala.net
parent reply other threads:[~2003-06-18 5:31 UTC|newest] Thread overview: expand[flat|nested] mbox.gz Atom feed [parent not found: <E19SV0D-000IcC-00.m_dvor-mail-ru@f25.mail.ru>]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=315207000.20030618093125@gala.net \ --to=team_pro@gala.net \ --cc=community@altlinux.ru \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Community general discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 community community/ http://lore.altlinux.org/community \ mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com public-inbox-index community Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.community AGPL code for this site: git clone https://public-inbox.org/public-inbox.git