mySQL ,sql file netbeans - mysql

How do I execute a .sql file using mysql and netbeans.
I am doing a course that requires me to interact with an .sql file that they have provided but the good guys at the Fitzwilliam institute haven't deemed it fit to explain how to use this file.
If can tell me that would be great.
I have already set up the basic database using netbeans and mySql.
Thank you

Ok, if you have created a connection to your MySql db, then things are pretty forward. Go to 'Services' tab, expand the Database options. Right click the connection you have created. Click 'Connect' to connect to the db. And then right click your connection and click 'Execute Command...'.
Write the command in the editor, and click the 'Run Sql' (Ctrl+Shift+E)

if the sql file is too large, netbeans cannot open it. In this case you can use the tool ij (link) which comes with Derby:
Start ij commandline tool and then do something like this:
ij> connect 'jdbc:derby:MyDbTest;create=true' user 'peter' password 'parker';
ij> run 'sqlscript.sql';

Running an SQL Script
Another way to manage table data in NetBeans IDE is by running an external SQL script directly in the IDE. If you have created an SQL script elsewhere, you can simply open it in NetBeans IDE and run it in the SQL Editor.
For demonstrative purposes, download ifpwafcad.sql and save it to a location on your computer. This script creates two tables similar to what you just created above (Counselor and Subject), and immediately populates them with data.
Because the script overwrites these tables if they already exist, delete the Counselor and Subject tables now so it becomes obvious that new tables are being created when the script is run. To delete tables:
Right-click the Counselor and Subject table nodes in the Database Explorer and choose Delete.
Click Yes in the Confirm Object Deletion dialog box. Note that the dialog box lists the tables that will be deleted.
When you click Yes in the Confirm Object Deletion dialog box, the table nodes are automatically removed from the Database Explorer.
To run the SQL script on MyNewDatabase:
Choose File > Open File from the IDE's main menu. In the file browser navigate to the location where you previously saved ifpwafcad.sql and click Open. The script automatically opens in the SQL Editor.
Make sure your connection to MyNewDatabase is selected from the Connection drop-down box in the toolbar at the top of the Editor.
Connection drop-down box in the SQL Editor toolbar
Click the Run SQL (run SQL button) button in the SQL Editor's task bar. The script is executed against the selected database, and any feedback is generated in the Output window.
To verify changes, right-click the MyNewDatabase connection node in the Runtime window and choose Refresh.
The Refresh option updates the Database Explorer's UI component to the current status of the specified database. Note that the two new tables from the SQL script now display as a table nodes under MyNewDatabase in the Database Explorer.
Choose View Data from the right-click menu of a selected table node to see the data contained in the new tables. In this manner, you can compare the tabular data with the data contained in the SQL script to see that they match.

Related

How do I amend shared data source definitions after SSRS migration to a diff node?

Do not seem to be able to find any place in the portal or Report Builder where I can actually edit the connect string & creds.
Report Manager shows the XML, but that really is it.
Disk files (from the looks of it) are no longer present in high versions (using SQL 2016/2017).
Is there a known location anywhere in GUI, or maybe direct edits in the SQL Server repository?
I can't even delete a shared source anymore, only view or test the connection.
If anybody could post a screenshot, it'll be highly appreciated.
EDIT: Just found out - when I create a new Data Source, it's editable; the imported data sources are not.
There are two ways of doing this. You can set the 'overwrite datasource' option in the project properties.
Or, you can got to the report portal , show hidden items in the view menu and there is a folder called "data sources". Open this and you will see all data sources, from there you can edit and save changes. All reports that use that datasource will be affected.

Why won't mysql workbench allow me to execute or create a schema?

I wanna create a schema because I wanna test out tables. I tried to click the "create a new schema", button at the top but it was glazed over where if I click it, nothing happens as if it isn't even there. So after this, I thought "Well I'll try and execute a schema via a statement until then I realized that the execute button is also glazed over. I'm wondering if there's something wrong and obvious I did since I just installed MySQL and have done nothing else in the settings.
You can right-click and create the schema from MySQLWorkbench. The steps are below:
List of Schemas in UI
Right-click, and select Create Schema
Specify the name of the schema to be created
Click Apply, confirm the SQL script in the dialog box, and again click Apply
Note the successful execution of the script
Verify the new schema in the Schemas section in UI

How can execute flexible search on japers reports?

I'm beginner in hybris. I need to create a jasper reports, using flexible search and mysql server. But I can only use the sql query statement without flexible search in report file (Jrxml source file (.jrxml)).
How can I using the flexible search with mysql?
Are you following the guide provided in Hybris Help for building a custom report? It can be found at https://help.hybris.com/6.3.0/hcd/8b6e40ee86691014b99eda29aebc9d84.html
In the interest of having a source of information in case the link ever becomes dead:
Go to ${HYBRIS_DIR}/hybris/bin/platform
setantenv.bat for Windows or . ./setantenv.sh for Unix/Linux
Go to ${HYBRIS_DIR}/hybris/bin/ext-platform-optional/virtualjdbc
Run the ant command ant dist
Go to ${HYBRIS_DIR}/hybris/temp/hybris/virtualjdbc. You should have two files that have been generated here, hybris-virtualjdbc.jar and vjdbc.jar
You now need to copy these two files to ${HYBRIS_DIR}/hybris/bin/ext-platform-optional/virtualjdbc/lib
Download the Jaspersoft Studio Tool at http://community.jaspersoft.com/project/jaspersoft-studio
Install and Open Jaspersoft Studio
Go to Tools > Options > iReport > Classpath
Click Add JAR twice, each time selecting one of the newly copied JAR files (hybris-virtualjdbc.jar and vjdbc.jar)
Click OK
You now need to setup the Data Source, to do this:
Click on the Report Datasource icon ()
In the newly opened window, click New
Select Database JDBC Connection and click Next
On the next screen you may provide any name for your JDBC Connection
In the JDBC Driver field, make sure you type de.hybris.vjdbc.VirtualDriver
In the JDBC URL field, make sure you type jdbc:hybris:sql:http:///virtualjdbc/service, where is the location of your application server (e.g. https://localhost:9002). Remember this will change with each environment!
Provide a Hybris User for the Username and Password. It may be worth using the admin user to begin with, but make sure you lock it down at a later stage to a user with less access, such as vjdbcReportsUser
Test the connection. Remember you will need the server up and running to be able to use vjdbc
From here onwards, you should be able to create a report using Flexible Search style syntax!

Create a standalone form shortcut in Microsoft Access 2013

I currently have a functioning form that searches through my database by calling a query. What I'm trying to do is turn this into a standalone application where I can simply open a file and only the form opens, running the database on the back-end. I have tried running a macro that opens the form, and I have tried creating a shortcut to my desktop, but nothing has worked.
Does anyone have any suggestions? Anything that will only show the form and the search results would be good (desktop shortcut, HTML file, etc.).
Thanks!
You will need to split your database so that the tables are located in a separate back-end file (which can be kept on a server). These instructions apply to Access 2007 and 2010 but the process is very similar for 2013.
Once this is done, your tables will become linked tables (stored in a separate file) and your front-end .addcb file will only contain queries, forms and reports.
You can control which form opens when the application loads through File -> Options -> Current Database. There are also several other useful controls here for limiting what the user can do; ie.
Hiding the list of database
Hiding the tabs (you will therefore need to create buttons to move between forms)
Hiding the Ribbon and/or status bar
Disabling Layout View
It's safest to change these settings on a copy, so you don't inadvertently lock yourself out; however, by holding down shift when opening the file from within Access, most of these options will be bypassed and you will be able to edit the database / revert these settings should you need to.
In terms of making it a "stand-alone application", it is possible to create a copy that will open without requiring the full version of MS Access on the user's PC (instead using Access Runtime).
I always distribute my front-ends as .accde format (File -> Export ACCDE). The benefits are as follows:
Smaller file size
Optimise memory usage / improves performance
VBA code runs but cannot be viewed or edited
I think what you're looking for is here:
http://office.microsoft.com/en-us/access-help/command-line-switches-for-access-HA010166605.aspx
and
http://office.microsoft.com/en-us/access-help/command-function-HA001228801.aspx
Basic idea, create a macro called AutoExec that checks for a command line argument when opening the database. Setup a shortcut with a command line argument (whatever you decide to name it, I'll use 'lookuponly' as the example.) like this:
"C:\Users\%Username%\Desktop\MyDatabase.mdb" /cmd "lookuponly"
when you double click the shortcut it should auto-run the macro and open your lookup form. Of course under newer versions of access you'll have to set the location of the database as a trusted location or access will attempt to block the database.
http://office.microsoft.com/en-us/access-help/decide-whether-to-trust-a-database-HA010256412.aspx

SSIS 2005 Saving Problem - SQL Task Editor

I have a relatively big SSIS package which I'm trying to edit. I basically need to update a query on an Execute SQL Task. Problem is the solution is not saving the query when I do the change. I open the SQL Task, change the query and close the task. I verify the change before saving and it's there but as soon as I click on the save button the change on the query disappears.
I verified for opened instances of the package but there are no other sessions on the machine. It does seems to be saving correctly on other packages included in the solution, but for some reason is not saving on my main package.
Make sure you have a backup copy of your package before you try this:
close the package (but keep the solution open)
right click the package and view code
search for your query and replace the query text with your new query text
save it
now double click the package to open it up like you normally do and view the query