Etherpad - PostgreSQL error: language "plpgsql" does not exist - database

I installed Etherpad lite and tried to use it with PostgreSQL database, but got this error:
events.js:72
throw er; // Unhandled 'error' event
^
error: language "plpgsql" does not exist
at Connection.parseE (/opt/openerp/etherpad/etherpad-lite/src/node_modules/$
at Connection.parseMessage (/opt/openerp/etherpad/etherpad-lite/src/node_mo$
at Socket.<anonymous> (/opt/openerp/etherpad/etherpad-lite/src/node_modules$
at Socket.EventEmitter.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:746:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
RESTART!
In other servers I didn't have such problem using PostgreSQL with Etherpad.
I created database using this command:
crate database etherpad WITH TEMPLATE template0;
My configuration in etherpad is like this:
"dbType" : "postgres",
"dbSettings" : {
"user" : "db_user",
"host" : "localhost",
"password": "my_password",
"database": "etherpad"
},
Everything else is left unchanged, except I commented dirty db settings.
P.S. with dirty db it works.

If you are using 9.1 and below, you should CREATE LANGUAGE plpgsql in template1, and then create your database based on that template. This should not happen or be required on PostgreSQL 9.2 and above.

Related

Phpstan doctrine database connection error

I'm using doctrine in a project (not symfony). In this project I also use phpstan, i installed both phpstan/phpstan-doctrine and phpstan/extension-installer.
My phpstan.neon is like this:
parameters:
level: 8
paths:
- src/
doctrine:
objectManagerLoader: tests/object-manager.php
Inside tests/object-manager.php it return the result of a call to a function that return the entity manager.
Here is the code that create the entity manager
$database_url = $_ENV['DATABASE_URL'];
$isDevMode = $this->isDevMode();
$proxyDir = null;
$cache = null;
$useSimpleAnnotationReader = false;
$config = Setup::createAnnotationMetadataConfiguration(
[$this->getProjectDirectory() . '/src'],
$isDevMode,
$proxyDir,
$cache,
$useSimpleAnnotationReader
);
// database configuration parameters
$conn = [
'url' => $database_url,
];
// obtaining the entity manager
$entityManager = EntityManager::create($conn, $config);
When i run vendor/bin/phpstan analyze i get this error:
Internal error: An exception occurred in the driver: SQLSTATE[08006] [7] could not translate host name "postgres_db" to address: nodename nor servname provided, or not known
This appear because i'm using docker and my database url is postgres://user:password#postgres_db/database postgres_db is the name of my database container so the hostname is known inside the docker container.
When i run phpstan inside the container i do not have the error.
So is there a way to run phpstan outside docker ? Because i'm pretty sure that when i'll push my code the github workflow will fail because of this
Do phpstan need to try to reach the database ?
I opened an issue on the github of phpstan-doctrine and i had an answer by #jlherren that explained :
The problem is that Doctrine needs to know what version of the DB server it is working with in order to instantiate the correct AbstractPlatform implementation, of which there are several available for the same DB vendor (e.g. PostgreSQL94Platform or PostgreSQL100Platform for postgres, and similarly for other DB drivers). To auto-detect this information, it will simply connect to the DB and query the version.
I just changed my database url from:
DATABASE_URL=postgres://user:password#database_ip/database
To:
DATABASE_URL=postgres://user:password#database_ip/database?serverVersion=14.2

XA error with SQL Server and Atomikos TransactionsEssentials

Wondering what this is about:
{
"#timestamp": "2021-12-22T07:16:00.315Z",
"log.level": "WARN",
"message": "XA resource 'xxxxxxxxDataSource': resume for XID '3137322E31382E302E322E746D313634303135373335313132343030303032:3137322E31382E302E322E746D31' raised -3: the XA resource detected an internal error",
"service.name": "xxxxx",
"process.thread.name": "main",
"log.logger": "com.atomikos.datasource.xa.XAResourceTransaction",
"error.type": "javax.transaction.xa.XAException",
"error.message": "The function START: failed. The status is: -3. Error: \" *** SQL_XA DTC_ERROR Context: DtcXaRM::GetTransactionCookie, StatusCode=-3 (0xFFFFFFFD), state=1, hr=0x8004D00E\"",
"error.stack_trace": "javax.transaction.xa.XAException: The function START: failed. The status is: -3. Error: \"*** SQL_XA DTC_ERROR Context: DtcXaRM::GetTransactionCookie, StatusCode=-3 (0xFFFFFFFD), state=1, hr=0x8004D00E\"\nat com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:652)\nat com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(SQLServ erXAResource.java:766)\nat com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:297)\nat com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.<init>(BranchEnlistedStateHandler.java:40)\nat com.atomikos.datasour ce.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:46)\nat com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:70)\nat com.atomikos.datasource.xa.session.SessionHandle State.notifyBeforeUse(SessionHandleState.java:160)\nat com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:207)\nat com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:122)...snip"
}
The error snippet is from the main Spring Boot application log. SQL Server runs in a separate Docker container, and I didn't see any errors there. I've tried enabling XA support in SQL Server by running EXEC sp_sqljdbc_xa_install, as instructed here.
Can't tell if it worked, but it didn't produce any errors either.
The runtime stack contains Atomikos TransactionsEssentials 4.0.6, Mssql-jdbc 6.4.0.jre, SQL Server 2019, and Hibernate 5.3.15.Final.

Why Wordpress host does not work in Bigdump?

I´m trying to import a big sql file for a Wordpress project that we should be really simple.
I would like to use BigDump because PhpMyAdmin make a 413 error.
BigDump does not connect with the server.
I got this error :
Warning: mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: H�te inconnu.
Database connection failed due to php_network_getaddresses: getaddrinfo failed: H�te inconnu
I report data from wp-config.php into bigdump.php like this :
$db_server <=> DB_HOST
$db_name <=> DB_NAME
$db_username <=> DB_USER
$db_password <=> DB_PASSWORD
Notice : DB_HOST is neither localhost nor 127.0.0.1
This is the php code which run this part :
$mysqli = new mysqli($db_server, $db_username, $db_password, $db_name);
if (mysqli_connect_error())
{ echo ("<p class=\"error\">Database connection failed due to ".mysqli_connect_error()."</p>\n");
echo ("<p>Edit the database settings in BigDump configuration, or contact your database provider.</p>\n");
$error=true;
}
It´s so weird,..should I input other thing in $db_server ?
Someone one could help me ?

Unhandled Java exception: com.microsoft.sqlserver.jdbc.SQLServerException connecting to Sql Server from Linux Server usingJruby

I am trying to connect to MS SQL Server Database using jruby on Linux server.
This is how my code looks like:
require 'rubygems'
require 'java'
require '/home/testuser/sqljdbc_6.2/enu/mssql-jdbc-6.2.1.jre8.jar'
Java::com.microsoft.sqlserver.jdbc.SQLServerDriver
url = 'jdbc:sqlserver://myremotedb.test.com:19263;databaseName=testappdatabase'
connection = java.sql.DriverManager.get_connection(url, 'testuser1', 'testpass1')
testconn = conn.createstatement
When i do this, I am getting the following error:
Unhandled Java exception: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'CORP/infautomic'. ClientConnectionId:ef4f1526-86d3-4e31-a3a8-31c1b026ac4b
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'testuser1'. ClientConnectionId:ef4f1526-86d3-4e31-a3a8-31c1b026ac4b
makeFromDatabaseError at com/microsoft/sqlserver/jdbc/SQLServerException.java:216
onEOF at com/microsoft/sqlserver/jdbc/tdsparser.java:254
parse at com/microsoft/sqlserver/jdbc/tdsparser.java:84
sendLogon at com/microsoft/sqlserver/jdbc/SQLServerConnection.java:2908
logon at com/microsoft/sqlserver/jdbc/SQLServerConnection.java:2234
access$000 at com/microsoft/sqlserver/jdbc/SQLServerConnection.java:41
doExecute at com/microsoft/sqlserver/jdbc/SQLServerConnection.java:2220
execute at com/microsoft/sqlserver/jdbc/IOBuffer.java:5696
executeCommand at com/microsoft/sqlserver/jdbc/SQLServerConnection.java:1715
connectHelper at com/microsoft/sqlserver/jdbc/SQLServerConnection.java:1326
login at com/microsoft/sqlserver/jdbc/SQLServerConnection.java:991
connect at com/microsoft/sqlserver/jdbc/SQLServerConnection.java:827
connect at com/microsoft/sqlserver/jdbc/SQLServerDriver.java:1012
getConnection at java/sql/DriverManager.java:664
getConnection at java/sql/DriverManager.java:247
invoke at java/lang/reflect/Method.java:498
invokeDirectWithExceptionHandling at org/jruby/javasupport/JavaMethod.java:483
invokeStaticDirect at org/jruby/javasupport/JavaMethod.java:375
invokeOther17:get_connection at sqljdbc.rb:7
<main> at sqljdbc.rb:7
invokeWithArguments at java/lang/invoke/MethodHandle.java:627
runScript at org/jruby/Ruby.java:827
runNormally at org/jruby/Ruby.java:746
runNormally at org/jruby/Ruby.java:764
runFromMain at org/jruby/Ruby.java:577
doRunFromMain at org/jruby/Main.java:417
internalRun at org/jruby/Main.java:305
run at org/jruby/Main.java:232
main at org/jruby/Main.java:204
How can i fix this?

com.microsoft.jdbc.sqlserver.SQLServerDriver not found

adapter.js file:
var procedure1Statement = WL.Server.createSQLStatement("select [sname] from [TestDb].[dbo].[studentinfo]");
function procedure1() {
return WL.Server.invokeSQLStatement({
preparedStatement : procedure1Statement,
parameters : []
});
}
adapter.xml file:
<dataSourceDefinition>
<driverClass>com.microsoft.sqlserver.jdbc.SQLServerDriver</driverClass>
<url>jdbc:sqlserver://localhost;databaseName=TestDb</url>
<user>user</user>
<password>pass</password>
</dataSourceDefinition>
getting error like this:
{
"errors": [
"Runtime: java.lang.ClassNotFoundException: Class com.microsoft.jdbc.sqlserver.SQLServerDriver not found in Worklight platform or project \/HelloWorld"
],
Read the error. Your error is that the driver is missing.
Make sure you have placed the jdbc driver in your-project\server\lib
Then make sure you are correctly pointing to the database in the XML file: IBM Worklight 6.1 - Failed connecting to MS SQL using SQL adapter

Resources