<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - Problem z odczytaniem tabeli w javie]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=549&amp;type=atom"/>
	<updated>2013-10-23T08:07:14Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=549</id>
		<entry>
			<title type="html"><![CDATA[Odp: Problem z odczytaniem tabeli w javie]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=4772#p4772"/>
			<content type="html"><![CDATA[do [b]sandrela[/b]
Przenieś swoje zapytanie do nowego tematu (trzeba utrzymywać jakiś porządek na forum), a postaram Ci udzielić odpowiedzi]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2013-10-23T08:07:14Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=4772#p4772</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: Problem z odczytaniem tabeli w javie]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=4771#p4771"/>
			<content type="html"><![CDATA[Cześć. Chce zrobić coś takiego, że łącze się z serwerem bazy i bez wyboru bazy danych. I wtedy jak się połącze selectuje wszystkie bazy do których mam prawa przynajmniej do odczytu.]]></content>
			<author>
				<name><![CDATA[sandrela]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1659</uri>
			</author>
			<updated>2013-10-22T12:28:05Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=4771#p4771</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: Problem z odczytaniem tabeli w javie]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=2405#p2405"/>
			<content type="html"><![CDATA[Zgadza się H to nie to samo co "H". Zmieniłem składnię zapytania na 

String mojsql = "Select * from \"T1\""; 
rs = stmt.executeQuery(mojsql);

.... i wszystko działa. 

Dziękuję za pomoc Temat uważam za zamknięty. 

Pozdrawiam]]></content>
			<author>
				<name><![CDATA[grzesinfo]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1200</uri>
			</author>
			<updated>2011-02-19T15:56:45Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=2405#p2405</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: Problem z odczytaniem tabeli w javie]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=2404#p2404"/>
			<content type="html"><![CDATA[No to pytanie czy istnieje h czy H.
Czy czasem jak tworzyłeś table to czasem nie napisałeś nazwy tabeli w cudzysłowie znaczy
[code]
create table "H"....
[/code]
bo jeśli tak to aby odczytać zawartość takiej tabeli musisz napisać
[code]
select * from "H"
[/code]
a to nie to samo co 
[code]
select * from H
[/code]]]></content>
			<author>
				<name><![CDATA[rski]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=26</uri>
			</author>
			<updated>2011-02-19T15:33:51Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=2404#p2404</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Problem z odczytaniem tabeli w javie]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=2402#p2402"/>
			<content type="html"><![CDATA[Witam 

   Mam problem z wykonaniem selecta na tabeli w Postgresie. Podłączenie do bazy przebiega poprawnie. Odczytuje bieżący czas z serwera bazy, a w momencie wykonania Selecta do tabeli wali błędem. Zaznaczam że tabela H istnieje w schemacie public. 

Proszę o pomoc. 



Kod programu: 

	private static void baza()
	{
		String url = "jdbc:postgresql://localhost/my";
		Properties props = new Properties();
		props.setProperty("user","postgres");
		props.setProperty("password","postgre");
		//props.setProperty("ssl","true");
		try {
			Connection conn = DriverManager.getConnection(url, props);
			System.out.println("Połączenie do Postgres OK.");
			Statement stmt = conn.createStatement();			
			ResultSet rs;
			PreparedStatement ps ;
			//ps = conn.prepareStatement("Select * from T1");
			rs = stmt.executeQuery("Select Now()");
			rs.next();
			System.out.println("Time:   "+rs.getString(1));
			stmt.executeQuery("Select * from  H");
			while (rs.next())
			{
				String sss = "A"+""+rs.getString(1);
				System.out.println(sss);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}


Błąd: 

Połączenie do Postgres OK.
Time:   2011-02-18 20:42:54.437+01
org.postgresql.util.PSQLException: ERROR: relation "h" does not exist
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
	at Fglowna.baza(Fglowna.java:50)
	at Fglowna.main(Fglowna.java:70)]]></content>
			<author>
				<name><![CDATA[grzesinfo]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1200</uri>
			</author>
			<updated>2011-02-18T19:45:57Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=2402#p2402</id>
		</entry>
</feed>
