SQL Squirrel vs Java - hsqldb

I am using SQL Squirrel to create a HyperSQLDB. I am using the HyperSQLDB from java.
The problem is when the database is open using SQL Squirrel i can't connect to it from java JDBC.
I need to close SQL Squirrel to use the database from java. If not i receive the message: java.sql.SQLException: Database lock acquisition failure: lockFile: org.hsqldb.persist.LockFile
The only way is to close SQL Squirrel. Is there anyway to disconnect from database, instead of close SQL Squirrel? Or othe solution.
Thanks

You should run a HyperSQL server. That way, you can have multiple connections at the same time, as all programs connect to the server which manages access.
You can start a server like this:
java -cp lib/hsqldb.jar org.hsqldb.server.Server --database.0 file:mydb --dbname.0 testdb
This starts a server with one (default) database. The DB files are named "mydb.*" and the public name of the database is "testdb".
For details, see the HyperSQL docs: Chapter 1. Running and Using HyperSQL - Server modes

Related

How to Execute SQL Server query (procedure) from another PC in network

Situation now
We have a netrowk set up. Some PCs have SQL Server 2012 installed, some don`t.
Is it possible to write a stored procedure and have it invoked/executed by another user/PC without SQL Server? For example by some .bat/.cmd script, I don`t know.
Desired situation
I write SQL query on my SQL Server management studio.
I save the query as a stored procedure. <-- up to here I am OK.
I do something that makes the procedure availible to other users. The advice I get from this question (I hope).
Other colleagues execute the procedure.
They get a result of the query in a CSV.
The client computers that need to run the stored procedure could install the sqlcmd utility. This allows for the execution of sql commands on another SQL Server.
SQLCmd -S<<SERVERNAME\INSTANCENAME>> -Q "Execute dbo.YourStoredProcedure"
And then have your stored procedure save the CSV file to a network drive or send it via e-mail.
Another way to retrieve data could be using the BCP utility. In this way the user could connect to your server, execute the query and receive a CSV file to a specified location on their computer.
In both cases it involves installing an additional program on the client computer.
You don't need SQL Server installed in the client machines to run queries or execute procedures. At most, depending on which programming language you are are using, you need the client installation for SQL Server. This is true for any DBMS, even Microsoft SQL Server 2014.
If you implement you code in Java, for example, you don't need even the MS SQL Server client. The JDBC driver for MS SQL Server is enough. It can be download from Microsoft and is not part of the SQL Server client installation.

Data integration between IBM AS400 to SQL Server database

I'm a web developer that has been tasked with creating some sort of mechanism for moving data from an IBM AS400 to a SQL server. Unfortunately, linked servers are out of the question in this case as the SQL Server is just Standard Edition (db2 providers not available in this version) and the AS400 server is on a separate server. I've researched adding some sort of trigger on the AS400 table that calls a web service that would insert data into the SQL server, but that doesn't seem like the best method. Does anyone have any suggestions on the process to get the data from the AS400 to the SQL Server when it is committed to the AS400?
This solution assumes you are familiar with SQL Server Integration Services (SSIS):
Connection to AS400
Create a new ADO.Net connection Manager
Set the Provider to .Net Provider --> ODBC Data Provider
Create a DSN (Control Panel -->Administrative Tools-->Data Sources ODBC -->System DSN)
In the connection manager for Data source specification select the DSN created. Provide the login information.
Test the connection.
Data flow source:
Use the DataReader source
In Advanced Editor select the Ado.Net connection manager just created.
In Component Properties tab --> Custom properties, in SQLCommand specify the required query string (select * from DatabaseName.TableName)
Check the column mappings for accuracy
Go to Input and Output properties -->Data reader output -->External columns (Select the columns which were of type varchar in the table, they will now be of the datatype UnicodeString (DT_WSTR). This is because by default DataReader reads strings as unicode strings. This implies that in the destination table in SQL these columns must be of type unicode i.e NVARCHAR instead of VARCHAR)
Answer sourced from www.sqlservercentral.com/Forums
I synchronize my web applications with an IBM i. But I have my own database design and wrote a sync program on the Windows side.
Having the same database design I wonder why I would need a copy on SQL server. I would access the IBM directly. Install the drivers as #Kamran Farzami suggested and use them. That way there would be no lag between writes on the mainframe and your queries.
If a lag is acceptable for you and you can't access the IBM i directly, I see three main options:
Pull the data from your Windows system with the OLE DB driver. Using the .NET driver you can use the relative record number (RRN) to remember where you stopped synchronizing.
Read the journal files and make them available by creating a webservice on the IBM i.
Read the journal files in a scheduled job and push the changes from the journal to a webservice which updates the SQL server.
Option 1 only works if the files you sync are not reorganized. The RGZPFM command changes the record numbers. If that's okay, you can get the RRN in your SELECT statement: select *, RRN(MYTABLE) as RRNMYTABLE from MYTABLE
The web service server is included in OS400 since V5R4. So you should be able to use option 2.
I've done something similar where the SQL server was in a remote (Honduras) location where the internet connection was unreliable. It was a short VB program, using the OLE DB driver, running on the server that connected to the AS400 when it was available (or "slept" when the connection was down). When available the program would update/synchronize a uniquely keyed mirror file. Another program uploaded individual transaction records to a separate table (file).
We'd also periodically update SQL Server master tables (i.e. item master) from the AS400. That also utilized a VB program (could be any language using the driver) initiated on the server. It isn't exactly elegant, but more practical than an AS/400 trigger to a web service, I believe.

Issuing Teradata SQL Assistant query via script

I use Teradata SQL Assistant to run SQL queries against a DB2 database accessed via an ODBC connection. This is an entirely interactive process whereby I first start the SQL Assistant app, then connect to the correct data source and finally write and execute my query.
What I would like to do is to be able to achieve the same result, i.e. get the result set from a query, but via some sort of script, which would connect to the the data source and run my query.
Is this possible?
Yes this is possible. Install the IBM Data Server Client software appropriate for your version of DB2, then use the DB2 command line processor with the -f option, as described in the manual.

Start Oracle SQL Developer

I have been trying to figure out how to start with Oracle SQL, but I can't get the "Connection" to work. I'm not sure what the (connection name, username, password, etc.) fields are.
If I want to create a small database on local host, why do I need to connect in the first place.
I searched Google but still can't get it to work. Any help is appreciated.
ERROR MESSAGE: IO Error: The Network Adapter could not establish the connection
SQL Developer is just a client utility that lets you connect to an existing database. It sounds like you don't have a database to connect to yet. If that's the case, you'd either need someone to create a database on another machine for you or you'd need to download the database software on to your local machine and create a database to connect to. You can download the Oracle database from the Oracle Technology Network, the same place you downloaded SQL Developer from. I would guess that you would want to download Oracle 11.2 Express Edition.
Alternately, you may want to download one of the VMs that Oracle has put together that has a lot of related software installed for you to use. For example, this VM has SQL Developer, Oracle 12.1, APEX, XML DB, and a number of labs already installed for you.
Oracle SQL Developer is a tool to ACCESS existing database, you cannot create new database here. The connection is used to define where your existing database sits and how to connect to it. So you need to name you connection (bookmark), provide host name, where database runs and user name plus password to identify yourself.

Get Started with Oracle Express Edition?

I'm novice in oracle.I'm using oracle express 10.2.0 but i don't know how to create my own database and where my database is created.(The path of my new database).
Not to be confused : in Oracle terminology, a database instance (called XE) is automatically created during installation (limitation : there can be only one database instance running at a time in Oracle Express).
What other vendors usually call a database (like in Sql Server) is a Schema in Oracle. To create one, use the CREATE USER command (and not the CREATE SCHEMA command : welcome to the marvelous world of Oracle !), using SQL*Plus or APEX.
I think it's possible to create a database schema through the web administration interface. Check the Getting Started Guide from the Oracle Database 10g Express Edition.
For the path to the files, this article may help: Creating an Oracle (XE) database manually on XP.
Creating a new database is easiest with the web frontend. Look inside the start menu for oracle.
Oracle 10g XE comes with the integrated browser interface. You can access it from http://machine-name:port/xe
It is almost similar to Oracle Enterprise manager. You can also try using Oracle Application Express on it, and develop web applications.