Hi Vijayakrishna,

con.setSchema("schema1");  should work, however it internally creates and sends invalid update statement:
 set schema = "schema1"
to the server. This is incorrect syntax.
Would you be so kind to log this issue in bugzilla via:
 https://www.monetdb.org/bugzilla/enter_bug.cgi?format=guided

As a work around you may execute the statement: set schema "schema1"
yourself after the connection is made.

Alternatively you may change the default schema for the user which is used to connect to the server.
  ALTER USER "user_name"  SET SCHEMA "schema_name"
See: https://www.monetdb.org/Documentation/SQLreference/Users
This way you should automatically get into the right schema for that user and you do not need to set the schema each time from your client application.

Regards,
Martin van Dinther


On 14-10-15 08:39, Vijay Krishna wrote:
Hi,

I am trying to connect a schema within a database directly through JDBC with the following Java code. 

Connection con = DriverManager.getConnection("jdbc:monetdb://localhost/testUser", "monetdb", "monetdb");
con.setSchema("schema1");

But this throws the following exception. 
Exception in thread "main" java.sql.SQLException: syntax error, unexpected '=' in: "set schema ="
at nl.cwi.monetdb.jdbc.MonetConnection$ResponseList.executeQuery(MonetConnection.java:2525)
at nl.cwi.monetdb.jdbc.MonetConnection$ResponseList.processQuery(MonetConnection.java:2273)
at nl.cwi.monetdb.jdbc.MonetStatement.internalExecute(MonetStatement.java:497)
at nl.cwi.monetdb.jdbc.MonetStatement.execute(MonetStatement.java:338)
at nl.cwi.monetdb.jdbc.MonetStatement.executeUpdate(MonetStatement.java:533)
at nl.cwi.monetdb.jdbc.MonetConnection.setSchema(MonetConnection.java:1267)
at batcave.Monet.main(Monet.java:11)

Is it really possible to connect to a specific schema? Or the only option is to query as "schemaName.tableName" ??? 



Thanks & Regards,

Vijayakrishna.P.
Mobile : (+91) 9500402305.


_______________________________________________
users-list mailing list
users-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/users-list