0
votes

I am trying to connect to my data source using Connection pool objects in Websphere Application Server 8.5 and using Derby database. Here is the TestCode that I have written in my Enterprise Jave Project. But I am getting the below mentioned exception:

java.sql.SQLSyntaxErrorException: Schema 'TESTCONN' does not exist at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(Unknown Source) at org.apache.derby.iapi.jdbc.BrokeredStatement.executeQuery(Unknown Source) at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.executeQuery(WSJdbcStatement.java:1017) at dbConnect.TestClass.select(TestClass.java:43) at dbConnect.TestClass.main(TestClass.java:19)

I have created a data source in Websphere application server and connection is working fine.

Connecting to data source using DriverManager works fine. However with Context (in the above shared code) connection is established but it says Schema does not exist. It seems jndi name is empty. Are there any settings in WAS or in Java Project that needs to be changed or added?

I am struggling with this problem since one week. Looking forward for help. Thanks in advance.

2
try to use the exact name of your schema while getting the connection. - Keerthivasan
Thankyou. I changed the query to "SELECT * FROM TESTCONN.TESTTABLE" but got the same error again. java.sql.SQLSyntaxErrorException: Schema 'TESTCONN' does not exist. - user2968583
Can you provide the details (url) of the resource that you have configured? - Paul Vargas
This is the database url jdbc:derby://localhost:1527/testconn;user=testconn;password=testconn. Do you need any further information? - user2968583
The main issue is that connection pool provides handle to a database which is different from the database in ij interactive tool. Is this due to the different port number (2809 instead of 1527) ? Am I missing something.. - user2968583

2 Answers

0
votes

Is there a schema with that name in your database? See http://db.apache.org/derby/faq.html#schema_exist

0
votes

The problem was that a jar file (com.ibm.we.admin.client...) was missing. Also there were two instances of derby databases were running. Thank you!