Thursday, January 11, 2018

Always on group database fails. May be not accessible or recovery mode. This may due to some incident happened in the database server.

1.       Always on group database fails. May be not accessible or recovery mode. This may due to some incident happened in the database server.

Soution: set online database from primary database. Eg: let’s say you have two servers and each server has two availability groups. Server1 has availGroup1 as primary and server2 has availGroup2 as primary. The database ‘myDB’ has failed and it’s a member of availGroup2. AvailGroup2 resides in server2 and try to bring the ‘myDB’ online in server2.

ALTER DATABASE MyDB SET ONLINE

If you execute this in other server, you might get the error as

-----------------------------------------------------
Msg 5052, Level 16, State 1, Line 2
ALTER DATABASE is not permitted while a database is in the Restoring state.
Msg 5069, Level 16, State 1, Line 2

ALTER DATABASE statement failed.
---------------------------------------------------------

Give little time. Server2, MyDb will come online.
After MyDB comes online add database to the AvailGroup2 from the server2 and connect with the MyDb in the server1.




Monday, January 8, 2018

Fix for Certificate Error in Chrome - NET::ERR_CERT_COMMON_NAME_INVALID

this error comes in chrome due to upgration done in the TLS process.
Below URL has described this clearly.

http://www.expta.com/2017/06/fix-for-certificate-error-in-chrome.html


Sunday, January 7, 2018

Error: Apache Load Balancer Stop / Start

You must have seen the following error while trying to stop the Load Balancer.


Starting the 'Apache2.4' service
(OS 5)Access is denied.  : AH00373: Failed to open the 'Apache2.4' service

Reason and Solution
This is because, you do not permission.
In Linux give required permission.
In windows, Open the command prompt in admin mode.

Then you won't get the above error.


Thursday, January 4, 2018

Useful Chrome Browser features

1. check the disk cache write, read etc

chrome://net-internals/#timeline

once you type chrome:// , you will get popups for so many extenstions

Tuesday, December 26, 2017

Find the used ports in machine

We need to find the all the used ports in a machine. We can get to know easily with the command

netstat -ano

this will give the output as

Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:85             0.0.0.0:0              LISTENING       5180
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       892


IF you need to verify the PID with the processes, open Task Manager. This will show 'PID'

netstat -ano > log.txt

Tuesday, October 3, 2017

Cannot insert explicit value for identity column in table 'TableName' when IDENTITY_INSERT is set to OFF

You must have experience above error

Cannot insert explicit value for identity column in table 'TableName' when IDENTITY_INSERT is set to OFF

Reason: I have used annotation for hibernate. In my class i have not specified the "GenerationType" for the


@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID", unique = true, nullable = false)
public int getId() {
return id;
}



-----------------error-----------



SEVERE: Could not synchronize database state with session
org.hibernate.exception.SQLGrammarException: could not insert: [com.sqlserver.test.RestoreUSFinanceCube]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2267)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:52)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.sqlserver.test.main.AppUSCube.saveEntry(AppUSCube.java:37)
at com.sqlserver.test.main.AppUSCube.main(AppUSCube.java:18)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert explicit value for identity column in table 'RESTORE_US_FINANCE_CUBE' when IDENTITY_INSERT is set to OFF.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:232)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1672)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:460)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:405)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7535)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2438)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:208)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:183)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:348)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2247)
... 12 more

Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not insert: [com.sqlserver.test.RestoreUSFinanceCube]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2267)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:52)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.sqlserver.test.main.AppUSCube.saveEntry(AppUSCube.java:37)
at com.sqlserver.test.main.AppUSCube.main(AppUSCube.java:18)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert explicit value for identity column in table 'RESTORE_US_FINANCE_CUBE' when IDENTITY_INSERT is set to OFF.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:232)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1672)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:460)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:405)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7535)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2438)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:208)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:183)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:348)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2247)
... 12 more



Sunday, August 6, 2017

Spring Boot - Article 1

So what is Spring Boot ?

You must have heard the word "Spring". It is well known framework for Java developers. In simple, Spring is basically an Application Framework (which includes so many concepts like inversion of container...etc) for Java developers which helps to build applications using Spring's core features and more powerful features with build in and plugin extensions.

So what is Spring Boot then ?
Here are few explanation i came a cross in internet.

Spring Boot is a brand new framework from the team at Pivotal, designed to simplify the bootstrapping and development of a new Spring application. The framework takes an opinionated approach to configuration, freeing developers from the need to define boilerplate configuration.

Well looks to be lots of jargon of words :)

So what is it ?

Spring Boot makes it easy to create stand-alone, production-grade, Spring based applications that you can just run.

Here are some of the words/jargon which comes with the Spring Boot


  • Opinionated
  • Convention over Configuration
  • Stands alone
  • Production ready