Configuring MySQL server connection in SmartFoxServer - mysql

I have been trying to connect to mysql via JDBC in config.xml.
I've changed default values to proper values like below :
<DatabaseManager active="true">
<Driver>org.gjt.mm.mysql.Driver</Driver>
<ConnectionString>jdbc:mysql://127.0.0.1:3306/mysql</ConnectionString>
<UserName>root</UserName>
<Password></Password>
<TestSQL><![CDATA[SELECT NOW()]]></TestSQL>
<MaxActive>10</MaxActive>
<MaxIdle>10</MaxIdle>
<OnExhaustedPool>fail</OnExhaustedPool>
<BlockTime>5000</BlockTime>
</DatabaseManager>
But when i try to start SmartFoxServer, get following errors :
DB Manager Activated ( org.gjt.mm.mysql.Driver )
Can't load db driver: org.gjt.mm.mysql.Driver
11:13:16.054 - [ SEVERE ] > DbManager could not retrive a connection. java.sql.S
QLException: Configuration file not found
it.gotoandplay.smartfoxserver.exceptions.DbManagerException: The Test SQL statem
ent failed! Please check your configuration.
at it.gotoandplay.smartfoxserver.SmartFoxServer.setupZone(SmartFoxServer
.java:1843)
at it.gotoandplay.smartfoxserver.lib.ConfigReader.parse_Zones(ConfigRead
er.java:806)
at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigR
eader.java:174)
at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFo
xServer.java:339)
at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:
607)
Problems in config file: The Test SQL statement failed! Please check your config
uration.
it.gotoandplay.smartfoxserver.exceptions.ConfigurationException: The Test SQL st
atement failed! Please check your configuration.
at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigR
eader.java:199)
at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFo
xServer.java:339)
at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:
607)
Errors found in configuration files.
Unable to start the server.
Shutting down server...
Press any key to continue . . .
Please tell me what am i doing wrong ?
Any helps would be appreciated.

I found the answer.
Should copy MySQL Connector/J in :
C:\ProgramFiles(x86)\MySQL\MySQL Connector J\mysql-connector-java-5.1.26-bin.jar
to :
C:\Users\username\SmartFoxServerPRO_1.6.6\jre\lib\ext\
And then restart SFS.
It worked like a charm. Good Luck.

Related

Glassfish/Payara: can not create connection pool - There is no property isIsolationLevelGuaranteed in entity

I am using Payara 4.1.1 Full edition. (I tried both 4.1.1.171 and 4.1.1.164)
I want to create Mysql connection pool. (Tried both 5.1.39 and 6.0.6)
This is the example script that I use to create a connection pool (line breaks for improving readability):
asadmin create-jdbc-connection-pool
--datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource
--restype javax.sql.DataSource
--property user=username:password=password:DatabaseName=testDB:ServerName=localhost:port=3306 testDBPool
But I get that error:
remote failure: JDBC connection pool testDBPool creation failed.
java.lang.IllegalArgumentException: HV000039: Invalid property path.
There is no property isIsolationLevelGuaranteed in entity org.glassfish.jdbc.config.JdbcConnectionPool.
Command create-jdbc-connection-pool failed.
I tried the exact same script on Glassfish 4.1.1 and I get the same error.
But when I try this on Glassfish 4.0, it works properly.
How can I create a mysql connection pool on Payara/Glassfish 4.1.1? (I tried Admin Console but I get the same error.)
I've had this problem before. For this you need to add two properties as JVM Options.
-Duser.language=en
-Duser.region=US
I have also told you here
This worked for me with GlassFish 4.1.1:
asadmin create-jdbc-connection-pool
--datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource
--restype javax.sql.DataSource
--description "Connection pool for MySQL"
--isconnectvalidatereq=true
--validationmethod=table
--validationtable=DUAL
--property user=ghi-java:password="yourpassword":databaseName=dbname:serverName=localhost:port=3306:url="jdbc\:mysql\://\:3306/dbname" ghiDBPool
and then:
asadmin create-jdbc-resource --connectionpoolid ghiDBPool jdbc/ghiDbConnector.
Be sure to copy the mysql-connector-java-5.1.40-bin.jar in domain-dir/lib and restart the server.

PentahoSystem.ERROR_0014

After doing all the set up for mysql repository for pentaho bi-server 6.1. Here is what I got when I restart the server:
" The following errors were detected
One or more system listeners failed. These are set in the systemListeners.xml.
org.pentaho.platform.api.engine.PentahoSystemException: PentahoSystem.ERROR_0014 - Error while trying to execute startup sequence for org.pentaho.platform.engine.services.connection.datasource.dbcp.DynamicallyPooledDatasourceSystemListener
Please see the server console for more details on each error detected.
In systemListener.xml file you need to comment the following lines:
<!--<bean id="pooledDataSourceSystemListener" class="org.pentaho.platform.engine.services.connection.datasource.dbcp.PooledDatasourceSystemListener" />-->
<!--bean id="dynamicallyPooledDataSourceSystemListener" class="org.pentaho.platform.engine.services.connection.datasource.dbcp.DynamicallyPooledDatasourceSystemListener" />

Laravel 5.1 - `php artisan migrate` is giving 'PDOException'

I know this is a duplicate question however whatever I tried, unfortunately no luck. (To add, I am using MAMP)
I believe I successfully setup the database connection because, using the registration form (Auth/register), after submitting the form, I was getting the error PDO Exception: Driver not found before, but after changing to my MAMP to PHP 5.5.17 from the default(PHP 5.6.1), I started getting error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.users' doesn't exist, which I believe shows that the database connection is working and it's just the 'users table' is not created.
Here starts my problem. When I try to use php artisan migrate or migrate:{anything} in the terminal, it's throwing the error:
[PDOException]
could not find driver
But what I want to do is to use php artisan migrate to be able to create tables and migrate them.
Things I have tried:
I added <?php echo phpinfo(); ?> to if pdo files are successfully installed.
I get the result:
so I think it seems okay.
People were talking about opening /MAMP/bin/php/php5.6.1/conf/php.ini and adding extension=pdo_mysql.so in the code, but I have mine already placed there.
When I try php -i | grep PDO in the project root (/MAMP/htdocs/proj), I got:
PDO
PDO support => enabled
PDO drivers => sqlite
PDO Driver for SQLite 3.x => enabled
php -i | grep Conf and `php --ini also outputs:
Configuration File (php.ini) Path: /Applications/MAMP/bin/php/php5.6.1/conf
Loaded Configuration File: /Applications/MAMP/bin/php/php5.6.1/conf/php.ini but php artisan migrate still throwing the same error
SOLUTION:
I chose MAMP to use version 5.5.17 instead of 5.6.1 in the browser (from MAMP Preferences), however this time terminal was running the 5.6.1. What I did was first checking which PHP command and then, running the nano ~/.bash_profile command; and editing the version document. Now everything is up and running :)
What you see in the browser is that you have PDO enabled for PHP running through apache. But this does not mean you have it enabled for PHP running through CLI (in fact they are using two separate ini files). To confirm that you can try:
php -i | grep PDO
And you will see it is missing or not enabled. So what you need to do is to find which php.ini is using the PHP running through CLI and add the PDO module there:
php -i | grep Conf
It will output something like:
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini

Oozie - Got exception running sqoop: Could not load db driver class: com.mysql.jdbc.Driver

I am trying to perform an sqoop export on HDP sandbox 2.1 via Oozie. When I run the Oozie job I get the following java runtime exception.
'>>> Invoking Sqoop command line now >>>
7598 [main] WARN org.apache.sqoop.tool.SqoopTool - $SQOOP_CONF_DIR
has not been set in the environment. Cannot check for additional
configuration.
7714 [main] INFO org.apache.sqoop.Sqoop - Running Sqoop version:
1.4.4.2.1.1.0-385
7760 [main] WARN org.apache.sqoop.SqoopOptions - Character argument
'\t' has multiple characters; only the first will be used.
7791 [main] WARN org.apache.sqoop.ConnFactory - $SQOOP_CONF_DIR has
not been set in the environment. Cannot check for additional
configuration.
7904 [main] INFO org.apache.sqoop.manager.MySQLManager - Preparing
to use a MySQL streaming resultset.
7905 [main] INFO org.apache.sqoop.tool.CodeGenTool - Beginning code
generation
7946 [main] ERROR org.apache.sqoop.Sqoop - Got exception running
Sqoop: java.lang.RuntimeException: Could not load db driver class:
com.mysql.jdbc.Driver Intercepting System.exit(1)
I have copied jdbc driver file "mysql-connector-java.jar" to Oozie's shared library folder which I believe is "/usr/lib/oozie/share/lib/sqoop/". I have restarted my sandbox and tried to perform the export with Oozie again and I still get the same error.
The export works perfectly fine when I try performing it only via sqoop, so I presume Oozie needs its own set of drivers.
My question is, which Oozie directory am I suppose to copy my jdbc drivers to?
If you guys think I'm doing something wrong or you need further information, please let me know.
Thank you for your time.
Normally for Oozie the sharelib directory is /user/oozie/share/lib/ on HDFS where "oozie" would be the name of the user which is used to start the Oozie Server. I don't know what that is in case of HDP sandbox 2.1 , but you can use ps command to figure that out.
And for jars needed for sqoop action, I think you should copy the jar to /user/oozie/share/lib/sqoop/ folder.

Connecting a MySQL database to Glassfish classpath is not set or classname is wrong

I'm swapping out a derby database for a MySQL one. I had everything working before but after what I thought was the proper configuration I'm getting the error:
Caused by: javax.resource.ResourceException: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
Full error output from console:
Caused by: javax.resource.ResourceException: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:292)
at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:114)
at com.sun.gjc.spi.ManagedConnectionFactory.getDataSource(ManagedConnectionFactory.java:1292)
at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:148)
at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:101)
at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)
I've double checked some of the names, the connection pool and other resources.I've also added the MySQL driver .jars to the library of glassfish in both projects. The database was definitely working correctly through eclipse because I was able to view tables and display the resources inside the database context of eclipse. So I know that at least THOSE drivers are working correcly. Also the persistence.xml file looks good. it references the jdbc/mydatabase jndi reference like it should and default JTA is selected as the manament type.
Does anyone have another suggestion? Thank you
I've also added the MySQL driver .jars to the library of glassfish in both projects.
It was apparently not done right. The JAR has to go in /glassfish/domains/[domainname]/lib/ext folder of the Glassfish installation where [domainname] usually defaults to domain1. You can and should not configure it from the Eclipse side on.
Looks like I am replying very late, but however people who would be referring to this thread may find the following information being useful. So I am posting it here:
Download the connector Jar from http://dev.mysql.com/downloads/connector/j/5.0.html
unzip the pack and copy mysql-connector-java-verno-bin.jar
past the same at [GlassFish Installation Directory]/domains/[domain name]/lib folder
restart your domain and ping to check your connection in JDBC Connection Pools
There you go. If your MySql is running then it will ping the DB successfully
I copied the jar file to $glassfish_install_folder\glassfish\lib, after that it worked. I use glassfish 4.0.
Check this link from oracle.
I encountered this issue in 2018 and would like to note that if you are using glassfish 4 (current is 5) then it seems you have to use the Connector/J 5.1.47 version for it to work. If you use the current version (Connector/J 8.0.13) then exception mentioned in the original question keeps appearing, no matter where you place the .jar file.
With Connector/J 5.1.47 it works perfectly.
Solution is
> asadmin add-library /path/to/mysql-connector-java-bin.jar
Check this link:
https://blog.payara.fish/using-mysql-with-payara
I encountered this issue in 2019 and would like to note that if you are using docker image payara/server-full (I am using 5.194 so far) as I do the location to place the driver jar is:
/opt/payara/appserver/glassfish/domains/production/lib/
In the end I am doing something like this in the Dockerfile of payara server:
RUN wget http://central.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/2.2.0/mariadb-java-client-2.2.0.jar \
-O /opt/payara/appserver/glassfish/domains/production/lib/mariadb-java-client-2.2.0.jar