Ireneusz Kordal

Ranch Hand
+ Follow
since Jun 21, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Ireneusz Kordal

ksh agarwal wrote:
Ohh..sorry...this is my code basically:

And now please insert into this code in line #22 the below command:

then run the code and show us the output of this command (the query created by your code).
Did you read documentation for your oracle version ?

Here is a link for oracle 11g:

Example: Writing CLOB Data

Use the setCharacterStream method or the setAsciiStream method to write data to a CLOB. The setCharacterStream method returns a Unicode output stream. The setAsciiStream method returns an ASCII output stream.

The following example reads a vector of data into a character array, then uses the setCharacterStream method to write the array of character data to a CLOB. writer;

// read data into a character array
char[] data = {'0','1','2','3','4','5','6','7','8','9'};

// write the array of character data to a Clob
writer = ((CLOB)my_clob).setCharacterStream();

The next example reads a vector of data into a byte array, then uses the setAsciiStream method to write the array of ASCII data to a CLOB. out;

// read data into a byte array
byte[] data = {'0','1','2','3','4','5','6','7','8','9'};

// write the array of ascii data to a CLOB
out = clob.setAsciiStream();

Run mysql command from the command line and check if it connects to the database properly.
What operating system are you using ? WIndows, unix ?
Check if the database server is started, if not - start it.

Here is an example form my pc - I am using linux:

Punit Jain wrote:
To be short and precise..

where can i see my created databases in derby, in my system???
i have added derby to my eclipse plugins, and then i created one database, where can i see that database file??

Somewhere in the eclipse directory or - could be - in the project directory - if eclipse is using embedded driver.
Or somewhere in the database installation directory - if eclipse is using standalone installation server.
Say your data base is named "mydatabase", then fire "find / -name mydatabase -print" command if you are using linux,
or on Windwos right click on the root folder and choose "search files/folders" tool to find "mydatabase" directory .... and you will see ;)

At the beginning please read carefully documentation, especially this:

then choose how do you want to deploy your application (using the embedded driver or the standalone server - embedded is a better option in my opinion),
and how do you want to create the database on the client computer.
For example, you can create an installation script that will create the database (tables, procedures etc) on the client machine.
Another option might be to include code for database creation inside your application - the application checks if the database exists,
if no - creates it.

Riaan Nel wrote:My question relates specifically to how one can store an enum value on persisted data. Yes, the gender field could be of type Gender, but if you tried to write that away to SQL (using JDBC for instance), your database will have no idea what the Gender type is.

Just store enums as strings.
Enum does all required conversions for you, the only you need is to call 2 functions: toString() and valueOf():

You can also define a constraint on a database column to prevent values (strings) other than strings from enum,
this will prevent errors when someone stores (via direct update on the database table) unpermitted string in the column.
5 years ago
Not in jar.
I assume that you are using derby embedded driver.
Database files are created somewhere on the disk.
A full path to the database directory could be explicitly given in the connection string - in that case derby uses that path.
In case if only a database name is given in the connection string (without the full path), Derby searches the database in the "system directory".
The system directory could be declared using derby.system.home property.
If this property is not declared, then derby uses the current directory (current = directory in which the application - jar- was installed).

Sagar Dumbre wrote:
Any Other way to achieve the same ?

Just add some magic to the query to make it work:

This magic clause (select from select ) forces MySql to store a resultset from the first select (inner) in a temporary table,
and allows to bypass the restriction.

Bob Grossman wrote:

The code that actually calls the database, tryUpdate(), is:

What am I doing wrong?

The error message says, that the SQL passed to the aStatement.execudeUpdate is wrong (that is, SQL from the 'doThis' string)..
Since you didn't show us what you are passing to this string, it's hard to guess what exactly is wrong.

Red Ronin wrote:
Is this fast enough? Other comments? Thankx in advance!

If performance satisfies you (or your customer) ..... then yes, it is fast enough.
In other case there are some improvements possible.

First, you don't need 6 different regex patterns to check this condition,
only one is sufficient:

Follow this link to study regex patterns, it's really cool:

Second, don't use regex at all,
simple 3 calls to a function String.contains() would be much more faster:

Third, the given problem is: "find the shortest string".
In your case, a "string" is equivalent to one line from the file.
So, if you have found a line that matches the condition, and the length of this line is X,
then you need to check only lines that have length < X.
For each new line check if it size is < X, if no - then just skip this line and take the next one.
If you find a new line shorter than X, that meet the condition too, then set X = length on this new line.
In this way you avoid searching substrings within the string probably for 50% or even more lines.
6 years ago
Delete all '->' strings from the query:

CREATE TABLE resources (->resourceId INT(3) auto_increment primary key,
->aCategory VARCHAR (20),
->url VARCHAR (200),
->title VARCHAR (25),
->UNIQUE (url) )

Rajesh Nagaraju wrote:In the below link,

there is a sentence

Reads and writes are atomic for reference variables and for most primitive variables (all types except long and double).

Can some one be kind enough to tell me why is there a exception to long and double primitive data types.

Because double and long are 8 bytes length (64-bits),
and 16-bit processors have only instructions that operate on maximum 32-bits operands, but not on 64-bits.
In other words - 16-bit processor can read or write 32-bits from/to memory in one operation, but for variables that are 64-bits long requires more than 1 operation.
Hello Naved,

try this code:

bat file is not an executable file ( .exe or .com ) , the operating system cannot execute bat, bats can be only executed by the command interpreter.
6 years ago

naved momin wrote:
if you look at the out put carefully and code you will find that value of changes whenever hashmap put's or get's the value thats the only thing left here i m not getting
can any one explain ?


follow this link :
This code is an implementation of HashTable in Java.
Look at these lines, this is a way Hastable.put() is implemented:

Do you see it ?
All your objects have the same hash value.
So HashTable stores them in the same bucket ( tab[ (hash & 0x7FFFFFFF) % tab.length ] ).
Buckets are implemented as simple arrays.
HashTable loops through all elements of this bucked (array) and for each table element calls it's element.equals( key ) method.
6 years ago