Mysql dependencies in securesocial - mysql

I am trying to use mysql 5.5.27 database into securesocial sbt-version 0.12.2 with play 2.1.0. What changes should I include into the variable appdependencies in Build.scala to include the mysql?

Add a line in the form:
"mysql" % "mysql-connector-java" % "5.1.18" // mySQL driver
in your appDependencies variable Seq.
Hope this helps.

Related

How to use ebean and mysql in play framework?

Im trying to create small CRUD application using play-java template.
Im using typesafe activator through cmd I create new project so now i want enable ebean and have to change mysql database. im using activator 1.3.6,
for sql im using my phpmyadmin sql 5.6.20 i googled and i did everything like documentary but still i couldn't solve my problem i couldn't add ebean my project and i couldn't connect mysql connector i did changes using this links
Ebean Mysql stackoverflow question but no use i wasted 3 days then i used play2-crud template enter link description here in this i can use eban but i dont know how to enable mysql and im using INTELLIJ IDE if anyone expert help me
To enable MySQL
in the application.conf file:
# Database configuration using MySQL database engine
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://127.0.0.1/mydataabse"
db.default.username=yourusername
db.default.password="yourpassword"
and you also need to add MySQL connector to the build.sbt libraryDependencies:
libraryDependencies ++= Seq(
...
"mysql" % "mysql-connector-java" % "5.1.18"
)
To enable Ebean
Add Ebean plugin In to the project\plugins.sbt:
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")
Enable this plugin in the build.sbt:
lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)
Configure Ebean in the conf\application.conf to take models from your model package:
ebean.default = ["my.models.*"]

Can't connect to mysql database with play-slick 1.0.1/slick 3.0 : configuration error

I'm trying to migrate from anorm to slick, using play 2.4.2, and getting a configuration error:
play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [dethcs]]
at play.api.Configuration$.configError(Configuration.scala:178) ~[play_2.11-2.4.0.jar:2.4.0]
...
Caused by: slick.SlickException: Error getting instance of Slick driver "slick.driver.MySQLDriver"
...
Caused by: java.lang.NoSuchMethodException: slick.driver.MySQLDriver.<init>()
Previous answers I've found on SO have focused on having the right MySQL driver and other dependencies. I believe my build.sbt covers the relevant bases, including:
libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.36"
libraryDependencies += "com.typesafe.play" %% "play-slick" % "1.0.1"
libraryDependencies += "com.typesafe.play" %% "play-slick-evolutions" % "1.0.1"
The relevant lines in my application.conf are:
slick.dbs.dethcs.db.driver="com.mysql.jdbc.Driver"
slick.dbs.dethcs.driver="slick.driver.MySQLDriver"
slick.dbs.dethcs.user="redacted"
slick.dbs.dethcs.db.url="jdbc:mysql://localhost/mydb"
slick.dbs.dethcs.password="redacted"
I'd be grateful for any suggestions as to how to fix this -- I'm guessing it's something silly but I've found it very difficult to get documentation and examples that are specific to more recent versions of slick -- and could provide additional info if that would help.
I haven't tried myself, but it looks like you are referencing the MySQLDriver class instead of the corresponding object. Put a trailing $ in it and you should be good to go:
slick.dbs.dethcs.driver="slick.driver.MySQLDriver$"

Perl error in MySQL and DBI

I'm a student of bioinformatics and I am using the OrthoMCL tool using this command
./orthomclLoadBlast my_orthomcl/orthomcl.config my_orthomcl/similarSequence.txt
but I am getting the error
Can't connect to data source ' :mysqllocalinfile=1' because I can't
work out what driver to use (it doesn't seem to contain a
'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at
/home/linux/Desktop/orthomclSoftware-v2.0.9/bin/../lib/perl/OrthoMCLEngine/Main/Base.pm
line 56
DBI is already installed in my system, so why is it giving this error? How do I solve it?
You need database drivers to be installed for the DBI module to work with your database. In this case it looks like you need to install DBD::mysql.
It is possible that OrthoMCL omits the driver name and uses just dbi::, in which case you must set the environment variable DBI_DRIVER to mysql.
The proper answer must be in the documentation for OrthoMCL. Have you read it?
Update
Looking at the source for orthomclLoadBlast it looks like your config file is faulty. There is a chance that someone here is familiar with the utility, but you must publish orthomcl.config to stand a chance of getting any useful advice.
you should use mysql for the driver:
sample:
use DBI;
$dbh = DBI->connect('dbi:mysql:DBNAME','root','password')

propel could not find postgresql driver - wrong pdo version?

I can't get the propel script running on my system.
My build.properties looks like this:
propel.project = test
# The Propel driver to use for generating SQL, etc.
propel.database = pgsql
# This must be a PDO DSN
propel.database.url = pgsql:host=localhost;port=5432;dbname=test
propel.database.user = user
propel.database.password = password
I get the following error when I run propel-gen . reverse:
[propel-schema-reverse] There was an error building XML from metadata:
/home/user/web/dev/vendor/propel/generator/build-propel.xml:296:1:
could not find driver
pdo_pgsql is enabled (there are several applications running it succesfully); but in my phpinfo there seems to be a wrong version stated:
PostgreSQL(libpq) Version 8.4.13
I'm running PostgreSQL 9.1. I think this causes the error but I have no idea why the versions are different. I have installed first PostGreSQL and then php5-fpm etc. via apt-get.
Using Php 5.3.5 on Ubuntu 11.04. Can somebody help?
Remove all empty spaces and newlines in between the xml tags in the buildtime-conf.xml. That worked for me.
My file looked like this after using the runtime-conf.xml as a template for the buildtime-conf.xml
...
<adapter>
mysql
</adapter>
...
Now it looks like that and it works
...
<adapter>mysql</adapter>
...

Multiple MySQL queries with Ruby

I'm having troubles with MySQL queries in Ruby. I use 'mysql' gem.
Configuration is stored in a separate yml file and loaded into #conf variable.
This is my code:
# connect to the database
Mysql::new(#conf['sql_host'], #conf['sql_user'], #conf['sql_password'], #conf['sql_base'])
# it's ok when we're doing this
my.query("SELECT * FROM `my_table`") do |e|
# code
end
# Maybe, I've missed something here...
# really this query will insert value into other table, used SELECT just for testing
# this throws exception: 'query: not connected'
my.query("SELECT * FROM `my_table_2`")
Windows XP
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
mysql (2.8.1, 2.7.3)
MySQL client version: 5.0.51a
Second query throws 'query: not connected'.
First of all, your program looks ok. I am 100% sure you have libmysql.dll version problem.
I can reproduce this with libmysql.dll provided from Mysql installer.
Download this file and replace in c:\ruby\bin\
http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll
and re-run your program without any change.
Related issue and credit to here
I have run into immeasurable problems when attempting to use Ruby's mysql gem on any version of Windows. From what I can tell, it simply doesn't work unless you can figure out how to compile it yourself (which is a royal pain in the ass).
Have you considered using ActiveRecord as your ORM (object relational mapping) layer and doing development with SQLite or some other database on Windows and then running the production environment on Linux with MySQL? This is the solution that I took a while back and it worked out quite well.