Hi there,
Just a quick note about the installation of basic portal. To give you some
background, I have just started tinkering with MVC and recently installed
basic portal to get some more experience. Nothing like a working example.
Kudos to Vic and the rest of the contributors. Greatly appreciated.
My note is related to the postgres installation actually. Initial symptom
was that upon entry I was getting a "[Exception in:/do/contentLstModule]
null" displayed. Upon further investigation I found out that my
tomcat/logs/catalina.out had the following exception:
DEBUG [Thread-5] (BasicDAOImpl.java:98) -
URL:jdbc:postgresql:net//localhost:5432/basicportal
DEBUG [Thread-5] (BasicDAOImpl.java:99) - User:xxxxxx
DEBUG [Thread-5] (BasicDAOImpl.java:100) - password:xxxxxx
DEBUG [Thread-5] (BasicDAOImpl.java:101) -
driver:org.sourceforge.jxdbcon.JXDBConDriver
BBug ***java.lang.RuntimeException: An I/O error occured:
java.net.ConnectException: Connection refused
End result was that postgres was not setup to accept TCP/IP connections.
My Linux system is Gentoo and the default install doesn't allow TCP/IP
connection and you have to manually enable it. To enable it, you have to
make sure that the startup options includes a "-i" option. (For your Linux
system, you could look in /etc/init.d/postgres if that's where you start
the db from. In my case all options are separate from init scripts in
/etc/conf.d/postgres)
On another note, here's some code to test your connection to the postgres
database.
import java.sql.*;
public class postgres {
public static void main(String[] args) {
System.out.println("trying...");
try {
String url = new
String("jdbc:postgresql:net//localhost:5432/basicportal");
String usr = new String("xxxxxx");
String pwd = new String("xxxxxx"); //postgres usr/password
System.out.println("finding driver...");
Class.forName("org.sourceforge.jxdbcon.JXDBConDriver");
System.out.println("creating driverManager...");
Connection db = DriverManager.getConnection(url,usr,pwd);
System.out.println("creating statement...");
Statement st = db.createStatement();
System.out.println("executing query...");
ResultSet rs = st.executeQuery("select * from base_content");
System.out.println("looping data...");
while(rs.next()) {
System.out.print("Column 1 returned ");
System.out.println(rs.getString(1));
}
System.out.println("loop finished, closing connection");
rs.close();
st.close();
}
catch( Exception e) {
System.out.println("Exception encountered: " + e);
}
}
}
Regards,
--
Haroon Rafique
<[EMAIL PROTECTED]>
_______________________________________________
MVC-Programmers mailing list
[EMAIL PROTECTED]
http://www.netbean.net/mailman/listinfo/mvc-programmers