executeQuery command is not working - hsqldb

executeQuery command is not working when fetching data from ms access in java 8 using hsql. While db is connected.
Don't know where I'm mistaking.?
String sql="select * from ADMIN";
rs=st.executeQuery(sql);

Related

Windows server 2012R2 Classic ASP Microsoft OLE DB Provider for SQL Server error '80040e4d'

I have a classic ASP application which has been moved to windows server 2012R2 two days before and sice then its showing a connection error in some sections of the application.
Microsoft OLE DB Provider for SQL Server error '80040e4d' Login failed for user 'sa'.
Login and some listing functionality are working fine but when Im accessing a billing page its showing the above mentioned error and we are using the same DB connection in the billing page also.
Following is the connection string used
Dim datasource,cnnCompanyDbase
Set cnnCompanyDbase=Server.CreateObject("ADODB.Connection")
cnnCompanyDbase.Open "Provider=SQLOLEDB;Initial Catalog=CompanyDatabase;Data Source=192.168.0.20;User Id=sa; Password=satest;"
Previously the application was running fine on windows server 2003.
Edit
After going through the code in detail, I found there is some slight difference in the record set opening with the DB command object.
Following is the two scenario
Working Condition
qryStaff="SELECT * FROM [Staff]"
Set rstStaff=Server.CreateObject("ADODB.Recordset")
rstStaff.CursorType = adOpenStatic
rstStaff.Open qryStaff,cnnCompanyDbase
Error condition
qryJobClients = "SELECT Client FROM Jobs WHERE Jobs.[Job-billing]=3"
Set rstJobClients=Server.CreateObject("ADODB.Recordset")
rstJobClients.CursorType = adOpenStatic
rstJobClients.Open qryJobClients,getDBConnect()
In the above case the method getDBConnect() returns the cnnCompanyDbase. I have printed both and getting the exact value, only the difference is one is from a method and another is directly given DB command.

Blob Data, Reading/Storing in client machine is giving error, but working in developing machine.How.?

I created a table with the BLOB datatype, in Oracle Database,
I tried to retrieve/store data in BLOB Datatype using developer Machine, it is working Fine,
same application was installed on Oracle Client Machine that it is giving error like below
Object Reference is not set to an instance of an object
Procedure Call or arugument is not valid
Code like
da = New Odbc.OdbcDataAdapter("Select * From DOCUMENTSTAB", OdbcCon)
da.fill(ds,"DOCUMENTSTAB")
I am using VB .NET 2012 with SYSTEM.DATA.ODBC Connection Type.
Thanks

Share sqlite2 database with Yii webapp

Hi I've got a sqlite2 database that is being used by a PHP webapp and I want a Yii webapp to access it. At the moment I copied the db file to a local server and I've changed config/main.php to:
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/thedatabase.db',
),
When I run the Gii model generator I get:
CDbException
CDbCommand failed to execute the SQL statement: CDbCommand failed to prepare the SQL statement: SQLSTATE[HY000]: General error: 26 file is encrypted or is not a database. The SQL statement executed was: SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'
BTW I am able to convert the database to SQL using
Exporting sqlite2 database to SQL
Though I want the database to stay as an sqlite2 database so that the Yii app can access up to date user info.
After some thought it looks like it would be simpler to just use some code from the old PHP project in the Yii project...
$db = sqlite_open($databasefilename, 0666, $sqliteerror);
$query = sqlite_query($db, "SELECT password FROM user WHERE username='$username'");
$row = sqlite_fetch_array($query);
if ($row) {
return $row[password];
}
Edit:
When using that code I get the following error:
undefined function sqlite_open()
I'm using PHP Version 5.4.7...
http://au1.php.net/manual/en/function.sqlite-open.php
Here it says:
PHP 5 < 5.4.0
I got it working with the sqlite2 database by using 'sqlite2:' instead of 'sqlite:'
'db2'=>array(
'class'=>'CDbConnection',
'connectionString' => 'sqlite2:'.dirname(__FILE__).'/../../../thedatabase.db',
),
I can do queries like this:
Yii::app()->db2->createCommand($sql)->queryAll());
To stop Error 500 Object configuration must be an array containing a "class" element 'class'=>'CDbConnection' is required in config/main.php. I think that info is already included in the first database connection somewhere.

Not able to connect to OpenOffice Base - User lacks privilege or object not found Exception

I am trying to connect to an OpenOffice Base database from Java and execute a query, and have not been able to.
These are the steps I followed:
1) Created a Database 'TestDB.odb' in OpenOffice, and a table 'Movies' with columns (ID, Name, Director)
2) Downloaded hsqldb jar file and inclued in project build path
3) Used the following code to connect to it:
String file_name_prefix = "C:/Documents and Settings/327701/My Documents/TestDB.odb";
Connection con = null;
Class.forName("org.hsqldb.jdbcDriver");
con = DriverManager.getConnection("jdbc:hsqldb:file:" + file_name_prefix, "sa","");
Statement statement = con.createStatement();
String query1 = "SELECT * FROM \"Movies\"";
ResultSet rs = statement.executeQuery(query1);
Althoug I'm able to connect to the Database, it throws the following exception on trying to execute the query:
org.hsqldb.HsqlException: user lacks privilege or object not found: Movies
Tried googling, but have not been able to resolve my problem. I'm stuck and it would be great if someone could guide me on how to fix this issue?
You cannot connect to an .odb database. The database you have connected to is in fact a separeate set of files with names such as TestDB.odb.script, etc.
Check http://user.services.openoffice.org/en/forum/viewtopic.php?f=83&t=17567 on how to use an HSQLDB database externally from OOo in server mode. You can connect to such databases with the HSQLDB jar.
OLD thread.
I lost 2 days of my life until I changed the property:
spring.jpa.properties.hibernate.globally_quoted_identifiers = false
I was using mysql before and then I changed to hsqldb in order to run some tests. I kinda copied and pasted this property without looking and then you know - Murphy's law ...
I hope it helps.

SQL Server 2008 Instance connection issue

My problem is the following:
I installes SQL Server 2008 R2 on my Windows Server 2008. I tried it by using default instance name (MSSQLSERVER) and named instance. The Installation was successful without an error. The problem is now:
When I try to connect to my SQL Server with the Management Studio it can't connect to this instance when I write "SERVER1\MSSQLSERVER" as serveraddress. When I write "SERVER1" only in the serveradress field it works.
Note: I always try to connect as SA. The password is right. Dont know if that matters...
But I have to be able to connect to "SERVER1\MSSQLSERVER" because I always get errors when I want to connect to a server without instance by C#.
Can someone tell me where I am mistaking?
EDIT:
The C# code looks like this:
sqlConnection = "data source=(local);persist security info=True;User ID=sa;Password=12345;initial catalog=BBKat"
SqlConnection sqlCon = new SqlConnection( sqlConnection );
SqlCommand sqlCmd = new SqlCommand( sqlCmdString, sqlCon );
I think you are not mistaken at all. You do not write the default instance name while connecting. You can create aliases though as mentioned above.
Try with a single (local) in the server name. and the same in C# web config connectionString as Data Source=(local);Initial Catalog=YOUR_DB;Integrated Security=True
EDIT
Change the connection string as:
data source=(local);Integrated Security=False;User ID=sa;Password=12345;initial catalog=BBKat