cancel
Showing results for 
Search instead for 
Did you mean: 

The SQL statement "SELECT * FROM "SDBAH"" contains the semantics error[s]:

Former Member
0 Kudos

Hello all together,

actually I try to implement an user interface for using BRTools from a J2EE Application.

I created a datasource-alias "BRTOOLS" using netweaver administrator.

inside the implementation i execute the following code:

DataSource ds = (DataSource) ctx.lookup("jdbc/BRTOOLS");

Connection con = ds.getConnection();

String query = "select * from SDBAH;";

Statement stmt = con.createStatement();

try {

ResultSet rs = stmt.executeQuery(query);

........

As the result I get the following message:

The SQL statement "SELECT * FROM "SDBAH"" contains the semantics error[s]: - 1:15 - the table or view >>SDBAH<< does not exist.

Using SQLplus or dbconsole I can see and use the table SDBAH. The table scheme is "SAPSR3DB"which is the standard scheme for J2EE.

If I try:

select * from SAPSR3DB.SDBAH;

I get the same result.

What is wrong in my constellation?

Thank you very much in advance.

Greetings Stephan

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Which SAP NW version are you using.

If you are using SAP NW 7.1 CE you can try this blog

/people/sampath.gunda8/blog/2008/02/21/connecting-an-application-to-an-external-database-in-sap-nw-ce-71

Regards,

Srinivasan Subbiah

Former Member
0 Kudos

Good Morning,

I use NW Version 7.0 (2004s) and I want to connect to the system database no external database.

Regards,

Stephan

Edited by: Stephan Hofmann on Apr 16, 2008 8:29 AM

Former Member
0 Kudos

Hi, Stephan,

[Managing Aliases|http://help.sap.com/saphelp_nw70/helpdata/en/b0/6e62f30cbe9e44977c78dbdc7a6b27/frameset.htm] says the following:

If you add an alias for the default DataSource, or for a DataSource that has been deployed with a service or a library, you have to restart the J2EE Engine cluster to enable the changes.

Did you do this after you registered your alias?

Regards,

Yordan

Former Member
0 Kudos

Dear Yordan,

yes I did a restart of the whole system.

If I do a wrong lookup:

e.g:

DataSource ds = (DataSource) ctx.lookup("jdbc/BRToolsFailure");

where Alias "BRToolsFailure" does not exist, I get

Object not found in lookup of BRToolsFailure.

So I think that the Alias of the default data source is right and visible.

Next try:

I use an already existing alias "ADS" in my code and get the same message:

The SQL statement "SELECT * FROM "SDBAH"" contains the semantics error[s]: - 1:15 - the table or view >>SDBAH<< does not exist.

If I extend the tablename with the scheme-name "SAPSR3DB" I get the following:

The SQL statement "SELECT * FROM "SAPSR3DB"."SDBAH"" contains the semantics error[s]: - 1:24 - the table or view >>SDBAH<< does not exist

When I use SQLPLUS SAPSR3DB/password and call:

select * from SDBAH;

I get a result like expected.

Thanks a lot,

Stephan

0 Kudos

Hello Stephan,

Did you manage to solve this problem?

I have exact problem in my system.

Thanks

Ami

Former Member
0 Kudos

Hi,

During the creation of datasource have you given your database name in the Database URL correctly.Does it match with the one you have created.

Regards,

Srinivasan Subbiah

Former Member
0 Kudos

Hi Srinivasan,

sorry I dont understand your question.

What I have done is the following:

I started the Netweaver Administrator and navigated the following path:

system management => configuration => application ressources

There I have selected JDBC Data Source Aliases from the dropdown list

press Create.

Ressource Type = JDBC Data Source Alias

Ressource Name = BRTools

System = E15 (SID of SAP DataBase)

JDBC Data Source = SAPSR3DB (SAP Scheme)

Then OK and I thought its enough.

What do you mean with:

database name in the Database URL

The database name is "E15", what is the database URL?

Thanks a lot in advance,

Regards Stephan

Former Member
0 Kudos

Hi,

String query = "select * from SDBAH;";

In the above query remove the semicolon and try like

String query = "select * from SDBAH";

Regards,

Srinivasan Subbiah

Former Member
0 Kudos

Hi Srinivasan,

first of all thank you for your quick reaction.

The statement without semicolon, as you recommended, I already tried before I created this thread.

But I tried it again, but the result was the same.

The SQL statement "SELECT * FROM "SDBAH"" contains the semantics error[s]: - 1:15 - the table or view >>SDBAH<< does not exist

It results from this code snippet:

try {

ResultSet rs = stmt.executeQuery(query);

}

catch (Exception re) {

throw new Exception(re.getLocalizedMessage());

}

Do you have another ideas solving my problem?

Thanks a lot,

Stephan