Reputation: 146
I have problems linking my Project to my database. I want to select stuff from a vertica database into my project. In normal PHP it works, but the same code does not work in Laravel:
# Connect to the Database
$dsn = "VerticaDSN";
$conn = odbc_connect($dsn,'','') or die ("<br/>CONNECTION ERROR");
echo "<p>Connected with DSN: $dsn</p>";
# Get the data from the table and display it
$sql = "SELECT column FROM table";
if($result = errortrap_odbc($conn, $sql))
{
echo "<pre>";
while($row = odbc_fetch_array($result) )
{
echo "hi";
print_r($row);
}
echo "</pre>";
}
Is there a method that this code works inside my Laravel Controller?
Upvotes: 0
Views: 789
Reputation: 66
What exact error have you? Is your $dns
correct? It must look like:
$dsn = 'Driver=Vertica;Servername=xxx;Port=5433;Database=yyy';
odbc_connect($dsn,'usr','pwd');
In my Github repository there are detailed instructions for the use of Vertica in Laravel.
Upvotes: 1