JDBC Probem with SELECT
Posted in 2000
Topics: Connectivity: ODBC / JDBC / .NET, Server Administration
Hello,
the following SELECT doesn't work via JDBC, but it works in dbaccess:
select odb_dbname
from sysmaster:sysopendb
where a.odb_sessionid = dbinfo("sessionid")
Any help appreciated
Thanks
Bernd
select odb_dbname
from sysmaster:sysopendb
where odb_sessionid = dbinfo("sessionid") -- not a.odb_sessionid
Is you have any database selected ? If not - try "database same_database;"
or specify database in URL string.
Bernd Steinhauer <bernd.steinhauer@dpd.de> ''''' '
''''''''':8ugo3l$1riu0$1@ID-59884.news.dfncis.de...
> Hello,
> the following SELECT doesn't work via JDBC, but it works in dbaccess:
>
> select odb_dbname
> from sysmaster:sysopendb
> where a.odb_sessionid = dbinfo("sessionid")>
> Any help appreciated
>
> Thanks
> Bernd
>
>
>
Bernd Steinhauer wrote:
> Hello,
> the following SELECT doesn't work via JDBC, but it works in dbaccess:
>
> select odb_dbname
> from sysmaster:sysopendb
> where a.odb_sessionid = dbinfo("sessionid")>
Your problem could be related to the fact that if you already have a
database, other than sysmaster, open, the query is going to return 2
rows - one for the current database and another for this query. Try the
same query in dbaccess after connecting to a database other than
sysmaster.
You could change that query to
select odb_dbname
from sysmaster:sysopendb
where a.odb_sessionid = dbinfo("sessionid")
and odb_dbname != 'sysmaster';
Rudy