INET_ATON with Apache Derby? - derby

I use a MySQL DB with jdbc and have select statement that looks like:
'SELECT id, name, INET_ATON(user_ip) AS user_ip_long FROM my_table;'
witch works perfectly, but for testing purpose I would like to use a derby DB aswell.
Since derby doesn't support inet_aton() I would like to know if ther is any workaround to use an inet_aton() function with derby?

You can write user-defined functions in Derby. Here's a nice blog with lots of step-by-step information: http://www.danvega.org/blog/2010/2/17/Creating-Apache-Derby-Custom-Functions-Part-2
And here's the Derby reference manual docs for the subject: http://db.apache.org/derby/docs/10.10/ref/rrefcreatefunctionstatement.html

Related

ORACLE'S UTL_TCP EQUIVALENT in POSTGRES

I'm working on a migration project from ORACLE to POSTGRES, and I need to find an equivalent of UTL_TCP for postgres , Is there any extension I should add or something like this ?
Thank you
There is no equivalent for that in PostgreSQL.
What I would do is write a function in PL/PerlU or PL/PythonU that accesses the network.

How to connect database with test complete tool

I want to connect with my MySQL database with the help of test complete. I am able to connect with MySQL Work Bench but I never try with test complete tool.
you can use a script in any language php, python, java ....etc. and call it with test complete
for example to use python you can use this code
import mysql.connector
cnx = mysql.connector.connect(user='scott', password='tiger',
host='127.0.0.1',
database='employees')
cnx.close()
you find read more here
http://dev.mysql.com/doc/connector-python/en/connector-python-example-connecting.html
good luck!
You can use the corresponding OLE DB or ODBC Provider to work with your database from TestComplete. Find a suitable connection string here and then use one of the approaches to work with a DB described in the Working With Databases help topic.
Please note that you may need to download and install MySQL OLE DB or ODBC Provider first.

Trouble setting currentSchema for DB2 on Glassfish

I've been working to move an application from MySQL to DB2, and am currently running into trouble with currentSchema on deployment.
The query:
SELECT count(*) FROM SomeTable WHERE BooleanColumn=1
will give me an error ( SQLCODE=-204) which means the object doesn't exist.
If instead I issue the query like this:
SELECT count(*) FROM SCHEMA.SomeTable WHERE BooleanColumn=1
Everything works as I would expect.
It seems like I should be able to set this to default to a schema somewhere, and at this point I have focused on the JDBC connection pool in Glassfish. It seems like I would usually be able to build a JDBC URL something like "jdbc:db2://SERVER_NAME:PORT/DATABASE:currentSchema=SCHEMA_NAME;", and currentSchema would take care of my needs, but I don't know how to do that in the admin control for Glassfish. I obviously don't know a lot about Glassfish - it is very likely I am looking in the wrong place.
I have the "Additional Properties" portion configured something like this:
Blah. I guess I'm too new to embed pictures...this link is this:
http://i.stack.imgur.com/IqUQd.jpg
Any help in getting this setup would be great...I don't want to have to hunt down every table reference and preface it with the schema name.
You can issue this statement in the same connection:
SET SCHEMA = my_schema;
By default, DB2 uses your username as the schema.

Setting connection info using XQJ with Oracle 11g

I am trying to submit XQuery queries to an Oracle 11g database through their XQJ API.
When I instantiate an oracle.xquery.xqj.OXQDataSource as explained in http://www.oracle.com/technetwork/articles/oem/xquery-jdbc-325944.html, I can submit queries fine except that I haven't found how I can set up the server connection (server name, port, username, password, ...) info:
This datasource claims that it doesn't support setting any property.
It doesn't implement the data source constructor which takes a JDBC connection.
I don't see any non standard method to set such info.
When I try to access some random collection like collection("oradb:/foo") I just get an empty result set even when no server is running, suggesting that the driver doesn't even try to connect.
What have I missed and how can I set the server connection info?
Thanks,
Eric
Thanks to Charles Foster I can answer to my own question: the XQJ implementation from Oracle is an old standalone version from January 2010 that is pretty useless and doesn't interact with Oracle databases.
Despite all the Oracle statements about XQJ, I haven't been able to find any client/server XQJ implementation (except one from DataDirect of course) and the way to submit XQuery queries to Oracle databases appears to be through JDBC, embedded in PL-SQL statements.
It is possible in 12.
XQJ to run queries in Java:
http://docs.oracle.com/database/121/ADXDK/adx_j_xqj.htm#ADXDK99930
XQJ to run queries against the database:
http://docs.oracle.com/database/121/ADXDK/adx_j_xqjxdb.htm#ADXDK136

How to use Oracle SQLdeveloper with HSQL / Hypersonic DB's JDBC driver

I'd like to use Oracle's SQLdeveloper to visualize my HSQLDB tables.
An instruction on how to use it with MySQL can be found on https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/programming-and-development/?p=564 ... and I know that Oracle points to a location where to download all JDBC drivers.
With MySQL this worked, however, including the JAR file from HSQLDB (here: hsqldb-1.8.0.10.jar) did not make a new tab show up (as is the case with MySQL).
Is there a way to "convince" SQLdeveloper working with HSQLDB and JDBC?
FYI, I am using Squirrel too but it's not as comfortable to work with compared to SQLdeveloper.
I was looking for the same thing, then found this:
http://forums.oracle.com/forums/thread.jspa?messageID=4241526&#4241526
So basically Oracle doesn't support it, and you can't add a new TAB on your own, even if you have the JDBC driver.
You can try other tool like ExecuteQuery (executequery dot org)

Resources