1
votes

I am trying to create an app using Play Framework with SQL Server 2008. Here is my Application.conf file:

db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver db.default.url="jdbc:sqlserver://localhost:1433;databaseName=DBTestPlay" db.default.user=sa db.default.password="xxyyzz"

After hitting the url localhost:9000 from the browser, the following "Database 'default' needs evolution!" page comes, and after clicking the "Apply this script now" button, nothing happens. Console shows "! @6h0n9oh2m - Internal server error, for (GET) [/] ->"

enter image description here

Here is my Model class

package models;

import javax.persistence.Entity;  
import javax.persistence.Id; 
import javax.persistence.Table;
import play.db.ebean.Model;

@Entity  
@Table(name="t_TestUser")  
public class DBUser extends Model{      
      @Id   
      public Long id;   
      public String name;

}

Can anyone please help me with that error? Any suggestion is highly appreciated ant thanks in advance.

N.B: I have also tried the "net.sourceforge.jtds" driver, but still no luck. I have tried to apply the script manually. The table generated successfully in my database. But Still, they ask to apply the script.

2

2 Answers

2
votes

I stumbled on the same issue and the fix was to drop play_evolution table and recreate it with datetime data type instead of timestamp for 'applied_at' field as explained it in here

The sql looks like below

create table play_evolutions (
                    id int not null primary key, hash varchar(255) not null, 
                    applied_at datetime not null, 
                    apply_script text, 
                    revert_script text, 
                    state varchar(255), 
                    last_problem text
                )

And after that, evolution script works fine.

0
votes

The error is actually proof that the driver is working. I don't know why the script wouldn't run without at least giving you an error.

Can you see what happens if you start the app with applyEvolutions.default=true in your application.conf?