• Welcome to KonaKart Community Forum. Please login or sign up.
 

Accessing the Database

Started by mtoon, March 25, 2008, 02:18:35 pm

Previous topic - Next topic

mtoon

Hello there!
I'm trying to figure out how to access the database directly from the payment module and the JSPs.  In my example, I'd like to make some database calls (external to konakart) when my custom payment module runs as well as retrieve this data on a JSP.  Any thoughts?  Ideally, I'd like to use whatever connection pooling the application is already using.

Thank you!

mtoon

Just a bump on this.  Is there any method hanging off any of the appif classes?
Thanks

trevor

We use Torque (http://db.apache.org/torque/) for the persistence layer, so you should read up on that if you want to use the same mechanism as KonaKart.

mtoon

I just needed a database connection..  I'm posting this in case it's helpful to anyone else...
Here's how I ended up getting the connection.

        Properties properties = new Properties();
        properties.load(new FileInputStream("../webapps/ROOT/WEB-INF/classes/konakart.properties"));
        String Driver = properties.getProperty("torque.dsfactory.oscommerce.connection.driver");
        String ConnectionURL = properties.getProperty("torque.dsfactory.oscommerce.connection.url");
        String UserName = properties.getProperty("torque.dsfactory.oscommerce.connection.user");
        String Password = properties.getProperty("torque.dsfactory.oscommerce.connection.password");

        Class.forName(Driver);
        Connection conn = DriverManager.getConnection(ConnectionURL, UserName, Password);