How to view database diagram in a Code First using localdb

Install Entity Framework Power Tools Beta 4, restart Visual Studio, right-click on the context in your solution view and you’ll see a new ‘Entity Framework’ option in the context menu. Select ‘View Entity Data Model’ to see a beautiful visual database diagram in Visual Studio. VoilĂ ! Entity Framework 6 Power Tools: Link

Check constraint on existing column with PostgresQL

Use alter table to add a new constraint: alter table foo add constraint check_positive check (the_column > 0); More details and examples are in the manual: http://www.postgresql.org/docs/current/static/sql-altertable.html#AEN70043 Edit Checking for specific values is done in the same way, by using an IN operator: alter table foo add constraint check_positive check (some_code in (‘A’,’B’));

SQL query to get the deadlocks in SQL SERVER 2008 [duplicate]

You can use a deadlock graph and gather the information you require from the log file. The only other way I could suggest is digging through the information by using EXEC SP_LOCK (Soon to be deprecated), EXEC SP_WHO2 or the sys.dm_tran_locks table. SELECT L.request_session_id AS SPID, DB_NAME(L.resource_database_id) AS DatabaseName, O.Name AS LockedObjectName, P.object_id AS LockedObjectId, … Read more

How to connect to multiple databases in Hibernate

Using annotation mappings as an example: Configuration cfg1 = new AnnotationConfiguration(); cfg1.configure(“/hibernate-oracle.cfg.xml”); cfg1.addAnnotatedClass(SomeClass.class); // mapped classes cfg1.addAnnotatedClass(SomeOtherClass.class); SessionFactory sf1 = cfg1.buildSessionFactory(); Configuration cfg2 = new AnnotationConfiguration(); cfg2.configure(“/hibernate-mysql.cfg.xml”); cfg2.addAnnotatedClass(SomeClass.class); // could be the same or different than above cfg2.addAnnotatedClass(SomeOtherClass.class); SessionFactory sf2 = cfg2.buildSessionFactory(); Then use sf1 and sf2 to get the sessions for each database. For … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)