Wednesday, July 22, 2015

How to save data in mysql database with sails.Js

Added Connection Configuration


Open /config/connections.js

******************************



 module.exports.connections = {

mysql: {

    module    : 'sails-mysql',

    host      : 'localhost',

    user      : 'root',

    password  : 'password',

    database  : 'test'

      }



Go to  /config/models.js

***************************


module.exports.models = {


  connection: 'mysql',


GO to api/models/User.js

****************************



module.exports = {

  connection: 'mysql',

  attributes: {

   

    name:{

     type:"string",

     required:true,

      minLength: 2

    },

    empnum:{

     type:"string",

     required:true

    },

    email:{

     type:"email",

     required:"true",

     unique: true

    }

   

  }


};


GO to api/controllers/UserController.js

*****************************************


module.exports = {


'registration': function(req,res){


    res.view();

},


create: function(req,res,next){


    User.create(req.params.all(), function userCreated(err,User){


        if(err){

            return next(err);

        }

        else{

 return res.send("Data Saved Successfully");


        }


    });

 }


 }


Type : http://localhost:1337/User

Monday, July 20, 2015

ORA-28002: the password will expire within 7 days

I have a user getting an ORA-28002 indicating that the password will expire within 7 days.







SQL:  select * from dba_users where username = 'PRABHA'

USERNAME                          USER_ID PASSWORD                       ACCOUNT_STATUS                   LOCK_DATE EXPIRY_DATE DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE           CREATED   PROFILE                        INITIAL_RSRC_CONSUMER_GROUP    EXTERNAL_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    PASSWORD_VERSIONS EDITIONS_ENABLED AUTHENTICATION_TYPE
------------------------------ ---------- ------------------------------ -------------------------------- --------- ----------- ------------------------------ ------------------------------ --------- ------------------------------ ------------------------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------- ---------------- -------------------
PRABHA                                107                                EXPIRED(GRACE)                             13-APR-15   CATALOGTBS                     TEMP                           20-AUG-14 DEFAULT                        DEFAULT_CONSUMER_GROUP                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          10G 11G           N                PASSWORD           

how to Install Sails js On Windows with mysql



1)  First install  node.js.

2)  Go to command prompt and type
     npm -g install sails


     








3) It will install in this path
  C:\Users\User\AppData\Roaming\npm\node_modules\sails

4)      Creating new Sails Project

    sails new honnikeryProject

C:\>sails new honnikeryproject
info: Created a new Sails app `honnikeryproject`!

5)   Now lift the server:
C:\>cd honnikeryproject
C:\honnikeryproject>sails lift

C:\honnikeryproject>sails lift

info: Starting app...

info:
info:                .-..-.
info:
info:    Sails              <|    .-..-.
info:    v0.11.0             |\
info:                       /|.\
info:                      / || \
info:                    ,'  |'  \
info:                 .-'.-==|/_--'
info:                 `--'-------'
info:    __---___--___---___--___---___--___
info:  ____---___--___---___--___---___--___-__
info:
info: Server lifted in `C:\honnikeryproject`
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press <CTRL> + C at any time.

debug: --------------------------------------------------------
debug: :: Mon Jul 20 2015 15:02:20 GMT+0530 (India Standard Time)

debug: Environment : development
debug: Port        : 1337
debug: --------------------------------------------------------


 http://localhost:1337
 you will see the default home page







Monday, July 13, 2015

MySQL DB import/export command line

 1) mysqldump -u [honnikery] –p[password]  [honnikery] > (dump_honnikery.sql)


Backup MySQL Database Structure Only

2) mysqldump -u [honnikery] –p[password] –no-data [honnikery] > (dump_honnikery.sql)


Backup MySQL Database Data Only

3) mysqldump -u [honnikery] –p[password] –no-create- [honnikery] > [dump_honnikery.sql]


Backup Multiple MySQL Databases into a Single File


4) mysqldump -u [honnikery] –p[password] –all-database > [dump_honnikery.sql]

MySQL Database  to import

mysql -u username -p databasename < filename.sql 

 mysql --u [username] --password=[password] [database name] < [dump file]

Friday, July 10, 2015

How to Backup Databases in MYSQL



1) mysqldump -u [honnikery] –p[password]  [honnikery] > (dump_honnikery.sql)


Backup MySQL Database Structure Only

2) mysqldump -u [honnikery] –p[password] –no-data [honnikery] > (dump_honnikery.sql)


Backup MySQL Database Data Only

3) mysqldump -u [honnikery] –p[password] –no-create- [honnikery] > [dump_honnikery.sql]


Backup Multiple MySQL Databases into a Single File


4) mysqldump -u [honnikery] –p[password] –all-database > [dump_honnikery.sql]