How to create database from existing SQL files in NetBeans? - sql

I have downloaded Geonetwork and opened it with NetBeans IDE 8.0.2. In that project, there exists some SQL files. How can i run them or create database based on these files?
Edit:
I have done some more research, and all i need is to connect to H2 driver, but somehow, i can't. It shows me this:
Cannot establish a connection to jdbc:h2: using org.h2.Driver (IO Exception: "java.io.FileNotFoundException: C:\Program Files\NetBeans 8.0.2\ .lock.db (The filename, directory name, or volume label syntax is incorrect)"; "C:\Program Files\NetBeans 8.0.2\ .lock.db" [90031-152]). So, how to fix this?

Go thru this document and you will have your database, Derby will give you a quick setup for your need.
NetBeans - Working with the Java DB (Derby) Database
Just remember to open your geonetwork sql files, from the file browser navigate to the location of the saved sql file and click open...
If you have other database already installed, such as MySQL, Oracle etc. You can check the documentation here (see database section)

Related

Azure Storage Emulator fails to init with "The database 'AzureStorageEmulatorDb57' does not exist"

I am having an issue with Azure Storage Emulator. I tried to re-initialise the database and got the error below.
This was after installing Visual Studio 2019 Preview but this may just be a co-incidence. I tried for an hour or so to get it running and then gave up and just reset my machine with the "keep my files" option, re-installed Visual Studio 2017 and the Azure Tools but still see the same problem.
I know a reset sounds a bit drastic but VS 2019 broke my Azure Functions in VS2017, they would not launch so I wanted a clean install.
If I manually create the DB with sqllocaldb create (version 13.1.4001.0), the DB gets created fine but the init still fails with the same message.
Any ideas?
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage
Emulator>AzureStorageEmulator.exe init
Windows Azure Storage Emulator 5.7.0.0 command line tool
Found SQL Instance (localdb)\MSSQLLocalDB.
Creating database AzureStorageEmulatorDb57 on SQL instance '(localdb)\MSSQLLocalDB'.
Cannot create database 'AzureStorageEmulatorDb57' : The database 'AzureStorageEmulatorDb57' does not exist. Supply a valid database
name. To see available databases, use sys.databases..
One or more initialization actions have failed. Resolve these errors before attempting to run the storage emulator again.
Error: Cannot create database 'AzureStorageEmulatorDb57' : The database 'AzureStorageEmulatorDb57' does not exist. Supply a valid
database name. To see available databases, use sys.databases..
After resetting my machine (and keeping files), I ran into this issue. For me, I was unable to run an Azure function in Visual Studio 2019 due to an error around being unable to start the emulator.
It looks like I had the same permissions issues as (I presume) my new account after reset, did not have permission to touch the DB.
I resolved this by:
Deleting the Azure Storage Emulator DB file: %USERPROFILE%/AzureStorageEmulatorDb[number].mdf
Then running AzureStorageEmulator.exe start with admin rights
I was then able to run the Azure Function without issue.
Stop the Azure Emulator if it is running.
Open SSMS and connect to your (localdb) instance.
Manually create the "AzureStorageEmulatorDb57".
Open a command prompt as Administrator.
Run the "AzureStorageEmulator.exe init".
Run your VS project.
I was running into this same issue after installing LocalDb for SQL Server 2017. These steps helped me to resolve the problem I was facing:
Open a command line in C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator
Run AzureStorageEmulator.exe init /forceCreate
From checking my error logs (located at %USERPROFILE%\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB), I saw
2018-12-21 15:41:13.47 spid65 CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'C:\Users{username}AzureStorageEmulatorDb59.mdf'.
This error lead me to the following post: https://dba.stackexchange.com/questions/191393/localdb-v14-creates-wrong-path-for-mdf-files
From reading answers there, I gathered that this is a bug in SQL Server 2017. Without having access to the patch, the solution that worked for me was granting Everyone access to modify C:\Users. This was only an issue on my development laptop, so I could afford to make that security change
or as commented by Andrii install CU13 HotFix for SQL Server 2017. After that AzureStorageEmulatorDb<xxx>.mdf will be created you your user directory as it should.
I had this problem and I don't know why an AzureStorageEmulatorDb57_log.ldf was still present in my %USERPROFILE% directory when I deleted my MSSQLLocalDB instance, but after dropping that file the problem went away.
I came across this issue where I had changed the userlogin to my machine. I have created the database from my previous useraccount. I have copied the database files to the new user account but it gave me this error. It seems to be a permission issue.
You need to find the saved location of the mdf and ldf file of this database. In my case it was stored in 'C:\Users\yourUserName'
Simply delete these files and run AzureStorageEmulator.exe init again and it will create the new mdf and ldf files for you.
After manually upgrading my MSSQL 2016 LocalDB to MSSQL 2019 following these instructions, I got the error mentioned as I was unaware that the Azure Storage Emulator uses LocalDB internally.
To fix it, I simply had to manually re-attach the database located in %UserProfile% with the following SQL command:
CREATE DATABASE [AzureStorageEmulatorDb510]
ON (FILENAME = 'C:\Users\<username>\AzureStorageEmulatorDb510.mdf'),
(FILENAME = 'C:\Users\<username>\AzureStorageEmulatorDb510_log.ldf')
FOR ATTACH;
Worked for me:
Delete any storage/sql database related to azure emulator
run this command on StorageEmulator path:
AzureStorageEmulator.exe init /server .
(Or your SQL instance, Mine was ".")
Check you had install Azure SDK with Visual Studio, if you did't you can add the feature
You can locate the mdf and ldf files in your userprofile directory. Just stop the emulator and copy those files to some other place and delete it from userprofile directory.
Then run the emulator again and it's going to create new mdf and ldf files.
Then stop the emulator and copy the old files back and restart the emulator. This way you won't loose any data.
I will help you with this. First of all create a sql server local db.
Then go to storage emulator folder
_-The Storage Emulator is installed by default to C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator.
Then run this AzureStorageEmulator.exe init /server
docs: AzureStorageEmulator.exe init /server localhost\SQLEXPRESS01
Open SSMS and connect to your (localdb) instance.
Manually create the "AzureStorageEmulatorDb...".
To add yet another answer, I did not have the any MDF or LDF files. Instead, I only had a config file at %USERPROFILE%\AppData\Local\AzureStorageEmulator\AzureStorageEmulator.5.10.config. I also could not connect to my local (localdb) instance with SSMS.
I changed the SQLInstance value in that config file to be localhost rather than (localdb)\MSSQLLocalDB, and it started working.
You should have an app called Microsoft Azure Storage Emulator.
Start this application.
If the application indicates that it is running run AzureStorageEmulator.exe stop first otherwise run AzureStorageEmulator.exe Start directly. Should create your database automatically, at least it did for me.
https://learn.microsoft.com/en-us/azure/storage/common/storage-use-emulator
This seems to be because the mdf file already exists but LocalDB doesn't have it attached. You can delete and recreate as others have mentioned, but in my case I was able to just re-attach it and it worked fine.
Open SSMS to (localdb)\mssqllocaldb
Right click Databases
Choose Attach
Click Add
Select the existing MDF file (mine was in my user profile and named AzureStorageEmulatorDb510.mdf)
Click Ok
Then try running the emulator again.
This solution is not recommended in generally, but you can try it.
I think AzureStorageEmulator by somehow can not full access the localDB whitch setup in directory has limited the permission.
You can go to folder propertiy > sercurity > edit to full permission ( with me directory is user > Appdata).
Then restart the emulator
cmd restart the azure emulator.
Now it worked. You must consider it's unsercurity later on.
I initialized the db instance and succeed, bu my SQLServer is 2017.
Then I search the solution and the doc said delete the trouble database will solve the problem. Maybe you can try it follow the steps in the doc.

Pentaho (5.0.5) Configuring for Mysql

I installed Pentaho BA suite 5.0.5 on linux platform. Everything works well in postgreSQL repository.
I REFERRED THIS LINK To Configure Mysql as reposity
But if try to configure mysql for pentaho, i'm facing Errors.
This are the changes i did :
1.Edited /home/pentaho/server/biserver-ee/pentaho-solutions/system/quartz/quartz.properties
line:300
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
2.Edited /home/pentaho/server/biserver-ee/pentaho-solutions/system/hibernate/hibernate-setting.xml line:15
system/hibernate/mysql5.hibernate.cfg.xml
3.Edited /home/pentaho/server/biserver-ee/pentaho-solutions/system/applicationContext-spring-security-hibernate.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/hibernate
jdbc.username=hibuser
jdbc.password=password
hibernate.dialect=org.hibernate.dialect.MySQLDialect
4.I copied audit_sql.xml file from /home/pentaho/server/biserver-ee/pentaho-solutions/system/dialects/mysql5 to /home/pentaho/server/biserver-ee/pentaho-solutions/system
Edited /home/pentaho/server/biserver-ee/pentaho-solutions/system/jackrabbit/repository.xml file and uncommented SQL-configuration
I copied mysql-connector-java-5.1.25-bin.jar file to tomcat/lib folder
i made changes in /home/pentaho/server/biserver-ee/tomcat/webapps/pentaho/META-INF/conetxt.xml file
driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/hibernate"
validationQuery="select 1" /> in jdbc /hibernate section
driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/quartz"
validationQuery="select 1"/>
in jdbc/Quartz section
I'm facing these errors :
1.pentaho.log file :EmbeddedQuartzSystemListener.ERROR_0001 - Scheduler was not properly initialized at startup
2.In pentaho user console ,Loading symbol remain forever without displaying files.
3.i'm not able to save reports.
That might be very simple - but pentaho platform is not shipped with mysql jdbc driver by default due to some kind of licensing issues.
So it is required to manually obtain mysql jdbc driver and put it into web server lib folder.
For tomcat (default installation) that will be /servers/.../tomcat/lib folder.
For this particular case that may be
/home/pentaho/server/biserver-ee/tomcat/lib
One more advice is to check full log under
/home/pentaho/server/biserver-ee/logs
That is the main place where pentaho platform keeps logs info.
Hope it will help.
By the way there is a pretty good pentaho info portal about configuring pentaho platform:
http://infocenter.pentaho.com/help/nav/2_3
Make sure you are pointing to Java 7 in your JAVA_HOME. When you have your JAVA_HOME pointing to Java 8, BI Server will not start correctly
This is a pentaho bug. Create a table in quartz database of mysql like this postgresql table:
CREATE TABLE "QRTZ"
(
name character varying(200) NOT NULL,
CONSTRAINT "QRTZ_pkey" PRIMARY KEY (name)
)

SQL Server 2012 installation Reporting Services Catalog error

I'm installing SQL Server 2012 at the moment and when I was about to run the installation, this error pops up:
On clicking the first failed test, which is "Reporting Services Catalog Database File Existence", this is what i get:
On clicking the second failed test, which is "Reporting Services Catalog Temporary Database File Existence", this is what i get:
So basically, both of the message box says me that "Catalog Database File" & "Catalog Temporary database files exists". Because of this, i need to select Reporting Services file-only mode installation.
My questions are:
How do i select file-only mode installation?
Do i've to close the setup and do something and afterwards run the setup again?
Btw, I had SQL Server 2012 installed before. I uninstalled it completely due to some strange errors and decided to reinstall a fresh copy of SQL Server 2012 and now I'm stuck with these errors. Any help will be sincerely appreciated. :)
Since you already had one installation of SQL Server done before, there was a database already created. That did not get removed. So when you reinstall, its trying to create the database with the same name, hence, the error. You need to delete the old files to continue the new installation.
From the direcotry
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA
Remove the following files
ReportServer.mdf
ReportServer_log.LDF
ReportServerTempDB.mdf
ReportServerTempDB_log.LDF
Try the Following link for further help.
Reporting Services Catalog Error.
For sql-server-2012 the path is:
C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQL2012\MSSQL\DATA
where MSSQL2012 is the instance name and the respective file names are:
ReportServer$MSSQL2012.mdf
ReportServer$MSSQL2012_log.mdf
ReportServer$MSSQL2012TempDB.mdf
ReportServer$MSSQL2012TempDB_log.mdf
Remove the following files from the C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA directory:
bulletReportServer.mdf
bulletReportServer_log.LDF
bulletReportServerTempDB.mdf
bulletReportServerTempDB_log.LDF.
This happens if you reinstall SQL Server and these files weren't deleted.

SQL Server Management Studio error "Saved settings file cannot be found"

Here is my problem:
Every time I start the "Microsoft SQL Server Management Studio", I get a warning
The automatically saved settings file "\\Settings\CurrentSettings-2012-02-13.vssettings' cannot be found.
The message goes on to say :
"You can change this file on the 'Import and Export Settings' Tools Options page". The IDE will use your most recent settings for this session.
Where is this setting? How to fix this?
thanks!
you can try with theses steps :
In the Tools menu, select Options.
Select Environment folder, choose Import and Export Settings
In Automatically save my settings to this file, enter the location you will backup.
Select OK.
This file is in : %userprofile%\Documents\Visual Studio 2008\Settings\CurrentSettings.vssettings
Nota : if you don't find file, you can get another file from your coleague
If SQL Server Management Studio is open close it
Open Registry Editor Navigate to the location
_HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL
Server\100\Tools\Shell_
Edit the value of the Reg Key "VisualStudioLocation" to
%USERPROFILE%\Documents\SQL Server Management Studio
Close Registry Editor and check if the problem is fixed
In my case: we have Documents folder as mapped network drive and it seems SQL management studio has issues with that. As a quick workaround I created settings file outside this network drive and it works. Only downside is settings are not synchronized but honestly I don't care :)
Use your favorite registry editor, or use regedt32.exe if you don't have a decent one. Navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<vsver>\profile, where <vsver> is the numeric version of visual studio that you are using, e.g. 6.0, 7.1, 8.0, 9.0. In there, you will find an entry AutoSaveFile. Edit this entry to point to a vssettings file that you want as your default settings file. If you don't have such a file, create one via "Tools->Import and Export Settings...->Export selected environments settings" first. Typical value for AutoSaveFile is %vsspv_visualstudio_dir%\Settings\CurrentSettings.vssettings, and typical value for DefaultSettingsDirectory is %vsspv_visualstudio_dir%\Settings\.
The statement in the error message "You can change this file on the 'Import and Export Settings' Tools Options page" seems to be incorrect. In particular, I was unable to reset the defaults no matter how many different ways I saved or loaded settings using the 'Import and Export Settings' Tools Options page. I had to resort to modifying the registry.
I had the same problem.
Turns out I had renamed the drive and this was causing the problem. Renaming it back to the original (as seen in the path in the error message) fixed the issue.
I managed to fix it with no registry changes.
Based on the instructions from this site:
http://sebastian.expert/the-automatically-saved-settings-file-currentsettings-vssettings-cannot-be-found/
Basically you need to change the default path in options.
Go to Tools/Options then Environment/Import and Export Settings
Change the path to existing one.
I found a lot of solutions which suggested to edit the following registry: HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\100\Tools\Shell\VisualStudioLocation
If there are people(like me) who do not have that entry, I managed to fix it by editing this one:
HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\100\Tools\Shell\Profile\AutoSaveFile
I run MS SQL Server 2008 R2

Use tnsnames.ora in Oracle SQL Developer

I am evaluating Oracle SQL Developer.
My tnsnames.ora is populated, and a tnsping to a connection defined in tnsnames.ora works fine. Still, SQL Developer does not display any connections.
Oracle SQL Developer Soars mentions, that if
you have Oracle client software and a tnsnames.ora file already installed on your machine, Oracle SQL Developer will automatically populate the Connections navigator from the net service names defined in tnsnames.ora.
I also tried to set my TNS_ADMIN environment variable, but after restarting SQL Developer there are still no connections displayed.
Any ideas?
Anyone successfully working with SQL Developer and tnsnames.ora?
In SQLDeveloper browse Tools --> Preferences, as shown in below image.
In the Preferences options expand Database --> select Advanced --> under "Tnsnames Directory" --> Browse the directory where tnsnames.ora present.
Then click on Ok,
as shown in below diagram.
tnsnames.ora available at Drive:\oracle\product\10x.x.x\client_x\NETWORK\ADMIN
Now you can connect via the TNSnames options.
This excellent answer to a similar question (that I could not find before, unfortunately) helped me solve the problem.
Copying Content from referenced answer :
SQL Developer will look in the following location in this order for a tnsnames.ora file
$HOME/.tnsnames.ora
$TNS_ADMIN/tnsnames.ora
TNS_ADMIN lookup key in the registry
/etc/tnsnames.ora ( non-windows )
$ORACLE_HOME/network/admin/tnsnames.ora
LocalMachine\SOFTWARE\ORACLE\ORACLE_HOME_KEY
LocalMachine\SOFTWARE\ORACLE\ORACLE_HOME
If your tnsnames.ora file is not getting recognized, use the following procedure:
Define an environmental variable called TNS_ADMIN to point to the folder that contains your tnsnames.ora file.
In Windows, this is done by navigating to Control Panel > System > Advanced system settings > Environment Variables...
In Linux, define the TNS_ADMIN variable in the .profile file in your home directory.
Confirm the os is recognizing this environmental variable
From the Windows command line: echo %TNS_ADMIN%
From linux: echo $TNS_ADMIN
Restart SQL Developer
Now in SQL Developer right click on Connections and select New Connection.... Select TNS as connection type in the drop down box. Your entries from tnsnames.ora should now display here.
I had the same problem, tnsnames.ora worked fine for all other tools but SQL Developer would not use it. I tried all the suggestions on the web I could find, including the solutions on the link provided here.
Nothing worked.
It turns out that the database was caching backup copies of tnsnames.ora like tnsnames.ora.bk2, tnsnames09042811AM4501.bak, tnsnames.ora.bk etc. These files were not readable by the average user.
I suspect sqldeveloper is pattern matching for the name and it was trying to read one of these backup copies and couldn't. So it just fails gracefully and shows nothing in drop down list.
The solution is to make all the files readable or delete or move the backup copies out of the Admin directory.
This helped me:
Posted: 8/12/2011 4:54
Set tnsnames directory
tools->Preferences->Database->advanced->Tnsnames Directory
https://forums.oracle.com/forums/thread.jspa?messageID=10020012&#10020012
On the newer versions of macOS, one also has to set java.library.path. The easiest/safest way to do that [1] is by creating ~/.sqldeveloper/<version>/sqldeveloper.conf file and populating it as such:
AddVMOption -Djava.library.path=<instant client directory>
[1] https://community.oracle.com/message/14132189#14132189