Re: resultSet.getObject("tableAlias.column") doesn't work

2011-11-16 Thread Boris Granveaud
Very strange. I've used MySQL 5.1.49 for my tests and Connector/J
5.0.8 and 5.1.18. Did you test with an InnoDB table? I can send you my
test project if you want.

Anyway, from what I understand after googling about this problem, this
is not in the specifications so this behavior is not consistent
between different databases.

Boris.

On 14 nov, 02:49, Thomas Mueller  wrote:
> Hi,
>
> According to my tests, also MySQL throws an exception
> for resultSet.getObject("u.id"). The same as any other database I tested. I
> guess you used a different (old?) version of MySQL.
>
> Yes, you need to use an alias.
>
> Regards,
> Thomas

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Criteria if a database should be embedded

2011-11-16 Thread Adam McMahon
I don't know if there are any strict criteria for embedded vs non-
embedded.

I am running a web app using H2 in embedded mode, and it is working
fine.

I chose embedded mode for the following reasons:

a) it is faster, as connections are within the same JVM and not over
another protocol
b) simple deployment
c) saves some resources, as you do not need to run another JVM

Here are some reasons why you may not want to run in embedded mode

a)  If multiple app servers need to connect to H2
b) If your database accessed so much that it makes sense to put it on
another cpu altogether.
c) management is a bit easier because you can use the web browser
interface, but you can't easily do that when it is in embedded mode
(there is a servlet which should allow you to do this, but I have not
tested it yet).


On Nov 14, 4:11 am, cnn  wrote:
> What will be the criteria to decide if the database should be embeded?
> I plan to develop a web application which is essentially CRUD and
> reporting style
>
> thanks
> -cnn

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Criteria if a database should be embedded

2011-11-16 Thread Thomas Mueller
Hi,

If performance is very important, you should also use an embedded database
(TCP/IP is quite a large overhead).

Regards,
Thomas

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



CREATE PROC equivalent

2011-11-16 Thread Igal
I was trying to find some sample code for Stored Procedures or UDFs in H2. 
 the only information I found was for using Java methods and Aliasing them 
for use as PROCs.

isn't there a simple way to create a proc in SQL code in H2?

for example, let's say that I have the following sample PROC in MSSQL:

CREATE PROC spGetItemsForType( @Type int ) as

  SELECT *
  FROM   ITEMS
  WHERE  TYPE = @Type;

is there an equivalent H2 Stored Procedure?  can you post the sample code?

thanks :)

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/I1hIoUPuaZwJ.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Trouble Opening Zipped DB - IO Exception

2011-11-16 Thread Kyle H
I've been running into some trouble while attempting to open the
zipped h2 db in read-only mode.
Initially I attempted to do so through the web interface that H2
provides, I received this error:

IO Exception: "zip:backup.zip!/TestDB outside /home/user/h2/
DB" [90028-160] 90028/90028

My H2 base dir is set to /home/user/h2/DB, as the exception mentions.
My zipped back-up copy of the database is currently in this
directory.  This leads me to think that my syntax was incorrect, and
I've tried a couple of different items for the JDBC URL (none have
worked).

jdbc:h2:zip:backup.zip!/TestDB (Generic H2 Embedded)
jdbc:h2:tcp://127.0.0.1:9092/zip:backup.zip!/TestDB(Generic H2 Server)

I've tried a couple of other variations, all landing me at the same IO
exception stating what I've posted for the above Exception.

What the heck am I missing?

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



String encoding in web console

2011-11-16 Thread Alexander Hartner
When I run a given query on the web console the resulting text is nicely 
formatted and indented. 

TEXT 
MORE TEXT


However when I read the string value from my own application I get back 

STRINGDECODE('TEXT\nMORE TEXT') 

which seems to be encoded in some form. I haven't seen this encoding before and 
was wondering what I can do to present the data in the same way the H2 console 
does. Also is there an option on the H2 console to not make it decode the text 
and show me the actual content including any special character ?

Thanks in advance
Alex

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: odbc errors

2011-11-16 Thread Thomas Mueller
Hi,

> but they result with error about foreign key.

Is there an database exception, if yes could you post it (the complete
error message including error code and stack trace)?

Regards,
Thomas


On Wednesday, September 28, 2011, Vadim K wrote:

> I use latest odbc driver to connect from windows7/windows 2008 to h2
> (latest).
>
> In my odbc client I don't see any tables I created in the test
> database.
> I can make visible only information.schema tables, but they result
> with error about foreign key.
>
> Here what I have in log.
>
> [176936-0.000]globals.extra_systable_prefixes = 'dd_;'
> [176936-0.001]exe name=alpha5 plaformId=2
> [176936-0.002][[SQLAllocHandle]][176936-0.002] in PGAPI_AllocEnv
> **
> [176936-0.003]** exit PGAPI_AllocEnv: phenv = 09882DC0 **
> [176936-0.003][[SQLSetEnvAttr]] att=200,3
> [176936-0.004][[SQLAllocHandle]][176936-0.004]PGAPI_AllocConnect:
> entering...
> [176936-0.005] PGAPI_AllocConnect: henv = 09882DC0, conn =
> 09882DF0
> [176936-0.005]EN_add_connection: self = 09882DC0, conn = 09882DF0
> [176936-0.006]   added at 0, conn->henv = 09882DC0, conns[0]->henv
> = 09882DC0
> [176936-0.007][SQLGetInfoW(30)][176936-0.007]PGAPI_GetInfo:
> entering...fInfoType=77
> [176936-0.008]PGAPI_GetInfo: p='03.51', len=0, value=0, cbMax=12
> [176936-0.009][SQLSetConnectAttrW][176936-0.009]PGAPI_SetConnectAttr
> for 09882DF0: 115 0001
> [176936-0.010]the application is ansi
> [176936-0.010][SQLSetConnectAttrW][176936-0.010]PGAPI_SetConnectAttr
> for 09882DF0: 102 0001
> [176936-0.011]PGAPI_SetConnectOption: entering fOption = 102 vParam =
> 1
> [176936-0.012][SQLSetConnectAttrW][176936-0.012]PGAPI_SetConnectAttr
> for 09882DF0: 103 0005
> [176936-0.013]PGAPI_SetConnectOption: entering fOption = 103 vParam =
> 5
> [176936-0.014][SQLSetConnectAttrW][176936-0.014]PGAPI_SetConnectAttr
> for 09882DF0: 113 
> [176936-0.015]CC_error_statements: self=09882DF0
> [176936-0.015]CONN ERROR: func=PGAPI_SetConnectAttr, desc='',
> errnum=216, errmsg='Couldn't set unsupported connect attribute 113'
> [176936-0.016][SQLDriverConnectW][176936-0.017]PGAPI_DriverConnect:
> entering...
> [176936-0.018] PGAPI_DriverConnect: fDriverCompletion=0,
> connStrIn='DSN=h2;'
> [176936-0.018]our_connect_string = 'DSN=h2;'
> [176936-0.019]attribute = 'DSN', value = 'h2'
> [176936-0.019]copyAttributes:
>
> DSN='h2',server='',dbase='',user='',passwd='x',port='',onlyread='',protocol='',conn_settings='',disallow_premature=-1)
> [176936-0.021]getDSNinfo: DSN=h2 overwrite=0
> [176936-0.022]rollback_on_error=1
> [176936-0.023]force_abbrev=0 bde=0 cvt_null_date=0
> [176936-0.025]globals.extra_systable_prefixes = ''
> [176936-0.025]our_connect_string = 'DSN=h2;'
> [176936-0.025]attribute = 'DSN', value = 'h2'
> [176936-0.026]copyCommonAttributes:
>
> A7=100;A8=4096;A9=0;B0=255;B1=8190;B2=0;B3=0;B4=0;B5=1;B6=0;B7=1;B8=1;B9=1;C0=0;C1=0;C2=[176936-20.189]PGAPI_Disconnect:
> about to CC_cleanup
> [176936-20.189]in CC_Cleanup, self=09882DF0
> [176936-20.190]after CC_abort
> [176936-20.190]SOCK_Destructor
> [176936-20.190]after SOCK destructor
> [176936-20.191]exit CC_Cleanup
> [176936-20.191]PGAPI_Disconnect: done CC_cleanup
> [176936-20.192]PGAPI_Disconnect: returning...
> [176936-20.192][[SQLFreeHandle]][176936-20.192]PGAPI_FreeConnect:
> entering...
> [176936-20.193] in PGAPI_FreeConnect: hdbc=09882DF0
> [176936-20.193]enter CC_Destructor, self=09882DF0
> [176936-20.194]in CC_Cleanup, self=09882DF0
> [176936-20.194]after SOCK destructor
> [176936-20.195]exit CC_Cleanup
> [176936-20.195]after CC_Cleanup
> [176936-20.196]after free statement holders
> [176936-20.197]exit CC_Destructor
> [176936-20.197]PGAPI_FreeConnect: returning...
> [176936-20.197][[SQLFreeHandle]][176936-20.198] in PGAPI_FreeEnv:
> env = 09882DC0 **
> [176936-20.198]in EN_Destructor, self=09882DC0
> [176936-20.199]clearing conns count=128
> [176936-20.199]exit EN_Destructor: rv = 1
> [176936-20.199]   ok
> [176936-20.200]DETACHING PROCESS
>
> There is no error in it. But no tables I receive. Could anybody
> suggest how to deal with odbc preferences, or may be there is another
> option?
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To post to this group, send email to 
> h2-database@googlegroups.com
> .
> To unsubscribe from this group, send email to
> h2-database+unsubscr...@googlegroups.com .
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Changing character set to latin1

2011-11-16 Thread Thomas Mueller
Hi,

H2 supports Unicode, there is no need to set the character set. You can't
set it.

You can set the collation however (only per database):
http://h2database.com/html/grammar.html#set_collation

Regards,
Thomas

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Slow Join request

2011-11-16 Thread Thomas Mueller
Hi,

In my view, it's the expected behavior. The selectivity of ELEMENTTYPE is
very low, meaning there are lots of rows with type 14. Therefore, the
database need to load a lot of data.

Regards,
Thomas

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.