How do I reformat v$session.osuser? - weblogic

I am trying to set up an Oracle WebLogic Datasource for my job. But every time I try to connect to the database, I get this error:
Connection test failed.
Message icon - Error Connection property: format error: Property is 'v$session.osuser' and value is 'Yann (Intern)'
I tried changing my username to "YannIntern" to remove the special characters, but the error is still the same and it also happens when I try to use Oracle SQL Developer. How can I stop the format error?

Java reads this from the user.name property which defaults from the os username. However, this can be overriden by setting -Duser.name=Yann
Here's an example in sqlcl
SQL> select sys_context('userenv', 'os_user') from dual;
SYS_CONTEXT('USERENV','OS_USER')
------------------------------------
klrice
<<< a short command to set java properties >>>
<<< which is the same as a -D property >>>
SQL> set property user.name kris
Setting user.name to kris (klrice)
SQL> #connect-klrice
Connected.
SQL> select sys_context('userenv', 'os_user') from dual;
SYS_CONTEXT('USERENV','OS_USER')
----------------------------------
kris
SQL>

Same happened to me, I have parenthesis in my computer's name. I spent a lot of time researching but finally, I have the solution (I created an account just to answer this haha). To solve this you have to:
-Go to the folder location where you installed SQL Developer.
-Then go to: \ide\bin\ide.conf
-At the end add the following line:
# Custom VM Option
AddVMOption -Duser.name=<YourUsername>
-Save the file, and restart SQL Developer, you will be able to connect and avoid that error message.

Related

TYPO3: SQL error: 'Incorrect integer value: '' for column 'sys_language_uid' at row 1'

I have newly setup TYPO3, but when I try to add/save content, it gives me this error:
SQL error: 'Incorrect integer value: '' for column 'sys_language_uid'
at row 1
The behavior is related to database management systems using strict mode, like MySQL since version 5.7. Disabling strict mode (like provided in the accepted answer) is just a work around.
The real solution would be to explicitly cast values to integer by modifying TCA (table configuration array) for the according field definitions.
for fields of type input that would be setting/extending 'eval' => 'int', see example tt_content.starttime
or in general for all field types it would be to define the default value using 'default' => 0, see example tt_content.sys_language_uid
set this in Localconfiguration.php file
[SYS][setDBinit] = SET SESSION sql_mode=''
For me, after trying different approaches, the solution was:
mysql -u root -p -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';"
Then, you can verify that the mode is set by running the following:
mysql -u root -p -e "SELECT ##GLOBAL.sql_mode;"
And you should see:
+---------------+------------------------+
| Variable_name | Value |
+---------------+------------------------+
| sql_mode | NO_ENGINE_SUBSTITUTION |
+---------------+------------------------+
In latest TYPO3 Versions you have to add this in LocalConfiguration.php
'setDBinit' => 'SET SESSION sql_mode = \'NO_ENGINE_SUBSTITUTION\';',
In Typo3 9.5/10.4
It you are not able to change the programming of the used extentions - or change the running mode of mysql server - it might be useful to change the mode of the typo3 connection. You can simply add to youre LocalConfiguration.php.
[DB][Connections][Default][initCommands]='SET SESSION sql_mode = \'\';',

Special character (!, exclamation mark) in DB2 user password gives error when starting i2 Analyze or connecting from DB2 command console

The following error occurs when starting i2 Analyze with example deployment
(some parts of error messages are in Finnish because of the Windows localization settings, sorry about that)
setup -t startLiberty
java.sql.SQLInvalidAuthorizationSpecException: [jcc][t4][2013][11249][4.17.29] On ilmennyt yhteyden käyttöoikeusvirhe. Syy: Käyttäjätunnus tai tunnussana ei kelpaa. ERRORCODE=-4214, SQLSTATE=28000 DSRA0010E: SQL State = 28000, Error Code = -4 214
I believe the error is more closely related to DB2(10.5 FP7) & Windows(W12R2) than i2 Analyze itself because when connecting from DB2 command console (db2cmd) and giving both username and password (with !) within a single line:
connect to WRITESTORE user db2admin using <SomePasswordWith!>
The error shown in console is as follows:
SQL0104N Järjestelmä on löytänyt merkkijonoa "<tunnus>" seuraavan
tunnistamattoman sanakkeen "!". Odotettuja sanakkeita ovat esimerkiksi
seuraavat: "NEW". SQLSTATE=42601
Anyhow, if password (with character !) is given only when prompted eg:
connect to WRITESTORE user db2admin
and giving password when asked, user is logged in without an error.
Also when connecting to DB2 with IBM DataStudio gives no error.
So, using passwords without special characters is a workaround for the issue.
http://www-01.ibm.com/support/docview.wss?uid=swg21303153
Username/password with special characters need to be quoted when using them through CLP within db2prompt
Lainausmerkkeihin :)
connect to WRITESTORE user db2admin using '<SomePasswordWith!>'

Running db2 from bash script not working?

I'm currently using bash on CentOS. DB2 is installed and db2 is on my path.
I have a few lines in a script which are supposed to update my db2 database, but they aren't working. As a minimal reproduction, I can do the exact same thing right in the bash command line and get the same error. Here's that reproduction:
$ db2 connect to PLT02345 user uni using uni; db2 update USM_USER set STATUS = 1 where NAME = 'asm_admin'
I expect this to set STATUS to 1 for everything in PLT02345.USM_USER where the NAME is currently asm_admin.
Instead, I get an error about "ASM_ADMIN" not being valid in the context where it's used. Here's the full output:
Database Connection Information
Database server = DB2/LINUXX8664 10.1.2
SQL authorization ID = UNI
Local database alias = PLT02345
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0206N "ASM_ADMIN" is not valid in the context where it is used.
SQLSTATE=42703
I'm confused - what about this makes it not valid? Is bash somehow mutilating the command and not passing everything as it should to db2?
If you're running this from the command line, Bash will drop the 's off 'asm_admin' because it simply assumes you're passing a string. The end result is the SQL becoming WHERE name = asm_admin which is invalid.
To correct this, you need to quote your whole command:
db2 "update USM_USER set STATUS = 1 where NAME = 'asm_admin'"

How do I fix "datasource serviceImpl.error_0009" in pentaho?

I log into pentaho using the administrator's username and password, then go into file > new > datasource select "SQL QUERY", then type in my database and test it for database connection, it is successful. When I try to test the new datasource with the sql query, I type in "select 1 from mytable" and it gives me this error:
datasourceServiceImpl.error_0009
query validation failed: query validation failed {0}
This is all that it is giving me and I don't know how to fix this.
I have biserver-ce-5.1.0.0-752 running
I fixed the issue by removing ";" at the end of my query.
Stop the server.
Change the mysql driver folder .. \ tomcat \ lib "mysql-connector-java-5.1.17.jar" the driver "mysql-connector-java-5.1.25-bin.jar".
Restart the server and it will work.
I got this error and found that it was as simple as having 2 columns named the same thing in my SELECT statement.
Install mysql-connector-java-gpl-x.x.x.msi
Put into lib folder mysql-connector-java-x.x.x.jar

sqlTool.rc contais password in plain text

I want to stop my HSQL DB from command line using command
java -jar hsqldb/lib/sqltool.jar --rcfile=sqltool.rc --sql "shutdown;" localhost-sa-myPassword
This command expects sqlTool.rc file which contains DB related information like user id and password. This RC file contains password in plain text.
Is there any way to hide that password in RC file?
Or is there any way to encrypt this RC file and use it?
Or is it possible to forcibly stop the server without giving id/pwd?
Any other approach is also welcome as long as password is not visible in plain text
Thanks in advance
I got alternative approach for this.
Connection c = DriverManager.getConnection(
"jdbc:hsqldb:file:/opt/db/testdb;shutdown=true", "SA", "");
create the connection as mentioned above.
Then execute sql query as given below
stmt.execute("shutdown");
This will shutdown the HSQL DB