Pages - Menu

Monday, January 28, 2013

Testing different database connections

Hello world!

I had to test some database connections from inside my application.

The user fill a form with the required information but before saving it to my PostgreSQL instance I had to check if everything is OK.

I was trying to use my model like this:


And guess what, as expected it replaces my application connection.

The solution is pretty simple, use the adapter class like:


The reason for this code be inside a bedin/rescue is that if anything is wrong with the connection data it will return 500 Internal Server Error

Problem solved.

No comments:

Post a Comment