Craeting QueueTable in OracleAQ 11.2.0 - queue

I have installed Oracle11.2.0(windows,32 bit) and tried to create a queuetable..
(I have granted all permissions for the jmsuser,AQ_ADMINISTRATOR_ROLE,AQ_USER_ROLE,DB_Access).
when try to create a queuetable, Oracle gives following issue;
oracle.jms.AQjmsException: ORA-01017: invalid username/password; logon denied
ORA-06512: at "SYS.DBMS_AQADM", line 81
My sample code is as follows,
createQueue(Session session) {
AQQueueTableProperty qt_prop;
AQQueueTable q_table;
AQjmsDestinationProperty dest_prop;
Queue queue;
qt_prop = new AQQueueTableProperty("SYS.AQ$_JMS_BYTES_MESSAGE");
/* create a queue table */
q_table = ((AQjmsSession) session).createQueueTable("jmsuser", "test_queue_table",
qt_prop);
}
Any idea?
Thanks

I solved this with following setting;
ALTER SYSTEM GLOBAL_TOPIC_ENABLED = FALSE;

Related

Retrieving of PostgreSQL native error code

I have installed unixODBC-2.3.1-4.95.x86_64 on my SLES 12 machine and writing some application. But I faced with problem of error handling in PosgreSQL using unixODBC.
To do this I created the following function:
void checkDiag (SQLSMALLINT handleType, SQLHANDLE handle)
{
SQLRETURN rc = SQL_ERROR;
SQLCHAR sqlState[6];
SQLINTEGER nError;
SQLSMALLINT recnum = 0;
SQLCHAR eMsg[SQL_MAX_MESSAGE_LENGTH];
SQLCHAR nativeError[SQL_MAX_MESSAGE_LENGTH];
while (rc != SQL_NO_DATA_FOUND)
{
rc = SQLGetDiagRec (handleType,
handle,
recnum,
sqlState,
&nError,
eMsg,
255,
NULL);
if (rc != SQL_NO_DATA_FOUND)
{
SQLGetDiagField(handleType,
handle,
recnum,
SQL_DIAG_NATIVE,
nativeError,
255,
NULL);
printf("RECNUM %d\n sqlState = %s\n nError = %d\n Error Message %s\n nativeError %s \n",
recnum, sqlState, nError, (char *) eMsg, (char *)nativeError);
}
recnum++;
}
}
I have been trying to use different variants of diagId in SQLGetDiagField : SQL_DIAG_MESSAGE_TEXT, SQL_DIAG_NATIVE, SQL_DIAG_SQLSTATE.
I got everything but not PostgreSQL error Id.
I am constantly getting Postgresql error code id = -1.
So my question is:
Is it possible to get native PostgreSQL error code id using unixODBC API ?
Could you please tell me what I am doing wrong?
I found a solution.
The contents of the config file odbcinst.ini was the following:
[PostgreSQL]
Description=PostgreSQL ODBC driver
Driver=/usr/lib64/unixODBC/libodbcpsql.so
FileUsage=1
After I changed the description of Driver entry in the configuration file I was able to get PostgreSQL native error code.
[PostgreSQL]
Description=PostgreSQL ODBC driver
Driver=/opt/PostgreSQL/psqlODBC/lib/psqlodbcw.so
FileUsage=1
psqlodbcw.so library is supplied by EnterpriseDB PostgreSQL which can be downloaded here https://www.postgresql.org/download/linux/suse/ .
After these modifications I can get native error code. Using the code provided above, the postgres error code value will be written into sqlState.

Password change plugin in poste.io fails

I am experiment with poste.io mail server. It uses rouncube as its web interface. I tried to enable the password plugin.
I see below error whenever I try to set the password:
[21-Mar-2017 13:00:31 +0100]: DB Error: [1] no such function: update_passwd (SQL Query: SELECT update_passwd('$1$LXeDlIT0$NGunS8gcCOSrKK2ZJ6RIW/', 'naidu#example.com')) in /opt/www/webmail/program/lib/Roundcube/rcube_db.php on line 539 (POST /webmail/?_task=settings&_action=plugin.password-save)
The internet is full of using mysql as the database. I think I have to update the password change query in
/opt/www/webmail/plugins/password/config.inc.php
from
$sql = 'SELECT update_passwd(%c, %u)';
to
$sql = 'UPDATE mailaccount SET password=%c WHERE nname=%u LIMIT 1';
The UPDATE statement above is valid for mysql. What is the equivalent for sqlite3 database?
I have a setup consist of postfix with sqlite and my sql query is as below:
UPDATE mailbox SET password=%c WHERE username=%u LIMIT 1
My sqlite config as below:
$config['password_db_dsn'] = 'sqlite:////var/vmail/postfixadmin.db?mode=0646';
$config['password_query'] = 'UPDATE mailbox SET password=%c WHERE username=%u LIMIT 1';
Add this for debugging:
$config['debug_level'] = 4;
$config['sql_debug'] = true;
$config['imap_debug'] = true;
$config['ldap_debug'] = true;
$config['smtp_debug'] = true;
Hope this helps.

How can I check the connection of Mongoid

Does Mongoid has any method like ActiveRecord::Base.connected??
I want to check if the connection that's accessible.
We wanted to implement a health check for our running Mongoid client that tells us whether the established connection is still alive. This is what we came up with:
Mongoid.default_client.database_names.present?
Basically it takes your current client and tries to query the databases on its connected server. If this server is down, you will run into a timeout, which you can catch.
My solution:
def check_mongoid_connection
mongoid_config = File.read("#{Rails.root}/config/mongoid.yml")
config = YAML.load(mongoid_config)[Rails.env].symbolize_keys
host, db_name, user_name, password = config[:host], config[:database], config[:username], config[:password]
port = config[:port] || Mongo::Connection::DEFAULT_PORT
db_connection = Mongo::Connection.new(host, port).db(db_name)
db_connection.authenticate(user_name, password) unless (user_name.nil? || password.nil?)
db_connection.collection_names
return { status: :ok }
rescue Exception => e
return { status: :error, data: { message: e.to_s } }
end
snrlx's answer is great.
I use following in my puma config file, FYI:
before_fork do
begin
# load configuration
Mongoid.load!(File.expand_path('../../mongoid.yml', __dir__), :development)
fail('Default client db check failed, is db connective?') unless Mongoid.default_client.database_names.present?
rescue => exception
# raise runtime error
fail("connect to database failed: #{exception.message}")
end
end
One thing to remind is the default server_selection_timeout is 30 seconds, which is too long for db status check at least in development, you can modify this in your mongoid.yml.

Fatal error: Class 'Mage_Productview_Helper_Data' not found in /app/Mage.php on line 546

In Magento admin, when trying to Add a New Role I am getting this error:
Login to admin
Go to System->Permmissions->Roles->Add New Role
Fatal error: Class 'Mage_Productview_Helper_Data' not found in /app/Mage.php on line 546
Please help. I tried to replace Adminhtml folder with fresh extraction folder but could not help
I solved this by:
adding
public static function helper($name)
{
$registryKey = '_helper/' . $name;
if (!self::registry($registryKey)) {
$helperClass = self::getConfig()->getHelperClassName($name);
if ($helperClass != "Mage_Productview_Helper_Data" )//add THIS line
self::register($registryKey, new $helperClass);
}
return self::registry($registryKey);
}
to /app/Mage.php (line 547)
And also, comment out:
if ( is_null($represent2Darray) ) {
//$result[$resourceName]['name'] = Mage::helper($module)->__((string)$resource->title);
$result[$resourceName]['level'] = $level;
}
in /app/code/core/Mage/Admin/Model/Roles.php (line 160)
Hope this helps.

Erlang and PostgreSQL

I try to execute simple PostgreSQL query with erlang and epgsql.
I do:
{ok, C} = pgsql:connect("localhost", "shk", "qwerty", [{database, "mydb"}]).
>> {ok,<0.34.0>}
Then:
{ok, Cols, Rows} = pgsql:squery(C, "select * from users").
But i got error:
=ERROR REPORT==== 27-Apr-2012::17:58:23 ===
** State machine <0.34.0> terminating
** Last message in was {'EXIT',<0.32.0>,
{{badmatch,
{error,
{error,'ð\236ð¨ð\230ð\221ð\232ð\220',<<"42P01">>,
<<208,190,209,130,208,189,208,190,209,136,208,181,
208,189,208,184,208,181,32,34,109,121,100,98,34,
32,208,189,208,181,32,209,129,209,131,209,137,
208,181,209,129,209,130,208,178,209,131,208,181,
209,130>>,
[{position,<<"15">>}]}}},
[{erl_eval,expr,3}]}}
** When State == ready
** Data == {state,undefined,<0.35.0>,5000,
[{<<"application_name">>,<<>>},
{<<"client_encoding">>,<<"UTF8">>},
{<<"DateStyle">>,<<"ISO, DMY">>},
{<<"integer_datetimes">>,<<"on">>},
{<<"IntervalStyle">>,<<"postgres">>},
{<<"is_superuser">>,<<"off">>},
{<<"server_encoding">>,<<"UTF8">>},
{<<"server_version">>,<<"9.0.7">>},
{<<"session_authorization">>,<<"shk">>},
{<<"standard_conforming_strings">>,<<"off">>},
{<<"TimeZone">>,<<"posixrules">>}],
undefined,undefined,undefined,
{30932,488494147},
{statement,undefined,undefined,undefined},
73}
** Reason for termination =
** {{badmatch,{error,{error,'ð\236ð¨ð\230ð\221ð\232ð\220',<<"42P01">>,
<<208,190,209,130,208,189,208,190,209,136,208,181,
208,189,208,184,208,181,32,34,109,121,100,98,34,
32,208,189,208,181,32,209,129,209,131,209,137,
208,181,209,129,209,130,208,178,209,131,208,181,
209,130>>,
[{position,<<"15">>}]}}},
[{erl_eval,expr,3}]}
What's wrong i do? How can i fix it?
Thank you.
The error string seems to be in russian if I recognize the characters.
To view the response you can use the following command:
io:format("~ts",[<<208,190,209,130,208,189,208,190,209,136,208,181,
208,189,208,184,208,181,32,34,109,121,100,98,34,
32,208,189,208,181,32,209,129,209,131,209,137,
208,181,209,129,209,130,208,178,209,131,208,181,
209,130>>]).
отношение "mydb" не существует
A quick google translate makes me think the database mydb does not exist or you do not have permissions to use it.
try simply doing
Response = pgsql:squery(C, "select * from mydb"),
io:format("~p~n",[Response]).
And see what he is giving back from the server, maybe you have typo or table don't exists etc.
also check this out http://www.erlangatwork.com/2009/01/erlang-and-postgresql.html
From epgsql docs:
Errors
Errors originating from the PostgreSQL backend are returned as {error, #error{}},
see pgsql.hrl for the record definition. epgsql functions may also return
{error, What} where What is one of the following:
{unsupported_auth_method, Method} - required auth method is unsupported
timeout - request timed out
closed - connection was closed
sync_required - error occured and pgsql:sync must be called
Try to include pgsql.hrl, capture the error and print the error message, that should point you to the right direction.