Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Jdbc > Can not access ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1872 of 1997
Post > Topic >>

Can not access the public schema

by mohamed_mohamed_186@[EMAIL PROTECTED] ("M.Khaled") Jan 17, 2008 at 11:53 PM

--0-313751123-1200642790=:17063
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hi,
  I had installed postgresql-8.1.9, But when I tried to run any sql
statement like the following:
  (1)select * from <TableName>;
          or
  (2)select * from public.<TableName>;
   
   on the query tool to access any table inside the public schema I got
the following error:
  ERROR:  relation "<TableName>" does not exist
                    or
  ERROR:  relation "public.<TableName>" does not exist
  thought I am logging in with a superuser account.
   
  -The second part of the problem is that I wrote a JDBC code to access
any table inside the public schema and I got the same errors.And the
following are the lines of code I wrote:
   
  Class.forName("org.postgresql.Driver");
   Connection connection =
DriverManager.getConnection("jdbc:postgresql://localhost/<DataBaseName>?user=user&password=password");
  
   System.out.println("connection>>>>>>>>>>>>> "+connection);
   Statement statement=connection.createStatement();   
   ResultSet resultSet=statement.executeQuery("select * from
public.<TableName>");
  //or
  //select * from <TableName>   
            while(resultSet.next()){
             System.out.println(resultSet.getString(1));
            }
  } catch (ClassNotFoundException e) {
   e.printStackTrace();
  } catch (SQLException e) {
   e.printStackTrace();
  } 
   
  -I ensured that I have a connection to the DataBase by printing the
connection to the console as you see.And the connection object was
printed.
   
  -Please advice.
   
  Thanks,
  Mohamed.

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it
now.
--0-313751123-1200642790=:17063
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

<div>Hi,</div>  <div>I had installed postgresql-8.1.9, But when I tried
to&nbsp;run any sql statement like the following:</div>  <div>(1)select *
from &lt;TableName&gt;;</div> 
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or</div>  <div>(2)select *
from public.&lt;TableName&gt;;</div>  <div>&nbsp;</div>  <div>&nbsp;on the
query tool to access any table inside&nbsp;the public schema&nbsp;I got
the following error:</div>  <div><FONT color=#ff0000>ERROR:&nbsp; relation
"<FONT color=#ff0000>&lt;TableName&gt;</FONT>" does not exist</FONT></div> 
<div><FONT
color=#ff0000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
or</FONT></div>  <div><FONT color=#ff0000>ERROR:&nbsp; relation
"public.&lt;TableName&gt;" does not exist</FONT></div>  <div>thought I am
logging in with a superuser account.</div>  <div>&nbsp;</div>  <div>-The
second part of the problem is that I wrote a JDBC code to access any table
inside&nbsp;the public
 schema and I got the same errors.And the following are the lines of
code&nbsp;I wrote:</div>  <div>&nbsp;</div> 
<div>Class.forName("org.postgresql.Driver");<BR>&nbsp;&nbsp;&nbsp;Connection
connection =
DriverManager.getConnection("jdbc:postgresql://localhost/&lt;DataBaseName&gt;?user=user&amp;password=password");&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;System.out.println("connection&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;
"+connection);<BR>&nbsp;&nbsp;&nbsp;Statement
statement=connection.createStatement();&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;ResultSet
resultSet=statement.executeQuery("select * from
public.&lt;TableName&gt;");</div>  <div>//or</div>  <div>//select * from
&lt;TableName&gt;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
while(resultSet.next()){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;System.out.println(resultSet.getString(1));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<BR>&nbsp;&nbsp;} catch (ClassNotFoundException e)
{<BR>&nbsp;&nbsp;&nbsp;e.printStackTrace();<BR>&nbsp;&nbsp;} catch
(SQLException e)
{<BR>&nbsp;&nbsp;&nbsp;e.printStackTrace();<BR>&nbsp;&nbsp;}&nbsp;</div> 
<div>&nbsp;</div>  <div>-I ensured that I have a connection to the
DataBase by printing the connection to the console&nbsp;as you see.And the
connection object was printed.</div>  <div>&nbsp;</div>  <div>-Please
advice.</div>  <div>&nbsp;</div>  <div>Thanks,</div> 
<div>Mohamed.</div><p>&#32;
      <hr size=1>Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile. <a
href="http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
"> Try it now.</a>
--0-313751123-1200642790=:17063--
 




 1 Posts in Topic:
Can not access the public schema
mohamed_mohamed_186@[EMAI  2008-01-17 23:53:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 7:05:46 CDT 2008.