how to create new database in H2? - h2

I have a site running locally on MySQL i want to run it on H2 database. I have just run h2.jar file for console on the browser but whenever I Log in I have seen the list jdbc:h2:/var/www/mysite/data/db; MODE=MySQL, information_schema and users.I can create tables in it but don't know how to create new database?
I am using Mode = MySQL
type = H2 Database Engine in Embedded mode.

From http://www.h2database.com/html/tutorial.html#creating_new_databases,
By default, if the database specified in the URL does not yet exist, a
new (empty) database is created automatically. The user that created
the database automatically becomes the administrator of this database.

The settings of the H2 Console are stored in a configuration file called .h2.server.properties in your user home directory. For Windows installations, the user home directory is usually C:\Documents and Settings\[username] or C:\Users\[username]. The configuration file contains the settings of the application and picked up when the H2 Console is started.
Below config to create a new database on startup:
add newline in property file.
0=Generic H2 (Server)|org.h2.Driver|jdbc\:h2\:tcp\://localhost/~/db_name|sa
open the command prompt go to the \bin directory where h2 has installed:
e.g. cd C:\Program Files (x86)\H2\bin
and run following the command
java -cp h2-1.4.194.jar org.h2.tools.Server.
Other General Settings:
webAllowOthers: allow other computers to connect.
webPort: the port of the H2 Console
webSSL: use encrypted TLS (HTTPS) connections.

Related

Oracle 11g XE - Can't login and database is down

Just installed Oracle 11g XE (Windows), but can't connect in SQL Developer or run any command in CLI.
When try to connect in CLI using SYS or SYSTEM with password defined during the install, get the following error:
ORA-12638: credential retrieval failed
When I tray to connect via SQL Developer (tried via SID and Service Name, hostname=localhost, port=1521, SID=xe), get this error:
Status : Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in
connect descriptor
Already tried change SQLNET.AUTHENTICATION_SERVICES = (NTS) to (NONE) in sqlnet.ora file. When I do this, get the following error when try to connect with the SYS or SYSTEM user and password:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Already tried every solution in Google results, like reinstall, stop and start services... Mostly ask for first connect in CLI to make some changes, but even this I can't accomplish.
Any suggestions on how connect to the database?
Found the solution:
I was installing in my company Windows user domain.
First uninstall any instance of Oracle XE 11g.
Switch to a local administrator Windows user and install Oracle XE 11g.
Sign off and back to company Windows user.
Edit the file C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\sqlnet.ora (or equivalent to your installation path). Change SQLNET.AUTHENTICATION_SERVICES = (TNS) to SQLNET.AUTHENTICATION_SERVICES = (NONE).
This change will allow you connect to database from you company Windows user.
As seen here: Error ORA-12638 in Oracle Database 11g
Try the following: Open command window, cd to Oracle bin directory, enter sqlplus /nolog. If you get a prompt enter connect / as sysdba. If you get connected then you can try "startup".
- -
Did you try to start the Oracle RDBMS service via Services (services.msc)?
Do you use an spfile? Check the registry for ORA_SID_NAME_PFILE that is different from default location of $ORACLE_HOME/dbs. Also check the default location. Use only the default location or the registry entry removing either the registry entry or the file in the default location depending on which you want to use.

How to change user permissions on a folder so postgres can acces it?

I want to export some data of my PostgreSQL Database with the COPY command.
The manual states: "COPY with a file name instructs the PostgreSQL server to directly read from or write to a file. The file must be accessible by the PostgreSQL user (the user ID the server runs as) and the name must be specified from the viewpoint of the server."
How can I make sure that the requirements are fullfilled, or otherwise enable them?
Im using Postgres 10 on a Windows 7 Notebook.
Login as PostgreSQL operating system user and try to read the file.
Alternatively, try COPY and see if you get an error message.

Admistration role lost for the default user "weblogic" in oracle webcenter content 12c, not able to login into webcenter console

I have lost the administration role for the default user "weblogic" in Oracle WebCenter content thus not able to login into the WebCenter console and Enterprise management.
screenshot when login with the weblogic user in managed server(/cs). The administration tab got lost.
screenshot when login with the weblogic user in the console and getting error 403 permission denied with the statement:
"User is not authorized to use this feature. To use this feature, you
must have the administrator role. Please LOGIN again."
Please help out as this was strange that the administration access got lost. I can not take much risk with the restart of the server as if it is stopped(by killing the process id, since weblogic is not having admin access now so can't getting stop by normal procedure) it might not start and block people who are working with contributor role.
export MW_HOME=/u01/app/oracle/product/fmw
export DOMAIN_HOME=$MW_HOME/user_projects/domains/prod
export CLASSPATH=$CLASSPATH:$MW_HOME/wlserver_10.3/server/lib/weblogic.jar
. $DOMAIN_HOME/bin/setDomainEnv.sh
cd $DOMAIN_HOME/security/
mv DefaultAuthenticatorInit.ldift DefaultAuthenticatorInit.ldift.old
java weblogic.security.utils.AdminAccount <username> <password> .
cd $DOMAIN_HOME/servers/AdminServer/data/
mv ldap ldap_old
nano $DOMAIN_HOME/servers/AdminServer/security/boot.properties
nohup sh $DOMAIN_HOME/bin/startWebLogic.sh &
https://bitbucket.org/snippets/jhult/ebrGd
http://www.snapdba.com/2010/05/how-to-reset-the-weblogic-admin-server-password/
From your directory (C:\Oracle\Middleware\Oracle_Home_1221\user_projects\domains\gateway_domain1\bin),
run “setDomainEnv.sh” or “setDomainEnv.cmd"
From your security directory inside your domain(C:\Oracle\Middleware\Oracle_Home_1221\user_projects\domains\gateway_domain1\security)
run java weblogic.security.utils.AdminAccount .
From your servers directory (C:\Oracle\Middleware\Oracle_Home_1221\user_projects\domains\gateway_domain1\servers\AdminServer), rename the data folder to something like data_old
similarly inside your security directory, rename boot.properties to boot.properties_old
create a boot.properties file to avoid prompting in weblogic and enter your new username and password there without space or tabs.
username=adminusername
password=adminpassword
now, restart your weblogic and login using new admin creds

Not able to login by SSO in oracle database when i set TNS_ADMIN parameter

I have my single sign on activated on oracle database D1 and other oracle database D2 which has password login method. I don't want to use oracle home Tnsnames.ora file. I created my own tnsnames.ora and added the both the databases.
I set TNS_ADMIN as path under which I give path of location where I keep my tnsnames file.
I try to do sqlplus /#db1 in command prompt then it throws an error saying "invalid username /password"
But when I use sqlplus /#db1 before tsetting TNS_ADMIN parameter, it takes my local tns file (I guess) and login properly.
Now after setting TNS_ADMIN, if I try sqlplus user/pass#DB2 this works properly as DB2 is accessed using password and SSO isn't activated on this server.
Issue is SSO login in SQLplus doesn't work when I set my TNS_ADMIN parameter, tns entries are correct as I use the same db1 which was before activating SSO.
Do I need to add some parameter in sqlnet.ora located at my tnsnsames file to activate my SSO or any special setting DBA do to activate SSO on user and tns so that I can also do the same to use my tnsnames.ora file.
Scenario
cmd > sqlplus /#db1 --Logs successfully
cmd> set TNS_ADMIN=path/tns (my tnsnames.ora file location)
cmd > sqlplus /#db1 --Logs successfully --Fails to login
cmd > sqlplus user/pass#DB2 --Logs successfully
Note that my tnsnames.ora is not changed and is kept original with connection use for db1 when it was password login.
We use Kerberos for this SSO login for oracle sqlnet file in oracle home path, we have set some parameters related to Kerberos such as Kerberos_CC_NAME, Kerberos_CONF, Kerberos_CONF_MIT parameters. I used the same in my sqlnet file but it didnt works.
You have to specify location of your wallet in sqlnet.ora file, see Profile Parameters (sqlnet.ora)
In case of problems edit your sqlnet.ora file and add these lines
TNSPING.TRACE_DIRECTORY = path (location where you like to get trace file)
TNSPING.TRACE_LEVEL = user
The trace file should provide more information what is going wrong.

Access is denied error when initializing PostgreSQL DB on Windows

I'm on Windows 10. I downloaded the most recent version of Psql.
I was like:
C:\Program Files\PostgreSQL\9.6\bin>initdb.exe "C:\psql_db"
The files belonging to this database system will be owned by user "Sean".
This user must also own the server process.
The database cluster will be initialized with locale "English_United States.1252".
The default database encoding has accordingly been set to "WIN1252".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory C:/psql_db ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... windows
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
"pg_ctl" -D "C:\psql_db" -l logfile start
C:\Program Files\PostgreSQL\9.6\bin>"pg_ctl" -D "C:\psql_db" -l logfile start
And it was like:
server starting
Access is denied.
I think you are trying to create the logfile inside C:\Program Files\PostgreSQL\9.6\bin, for which you don't have write permission
Specify something like "pg_ctl" -D "C:\psql_db" -l "c:\users\joe\logfile" start
This is because of windows file permissions. You can put the data folder on desktop "c:\Users\\Desktop\" instead of "C:\psql_db". Or maybe give your user more permissions.

Resources