Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to connect to cloudscape

 
jonathan Greens
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used Class.forName("com.ibm.db2j.jdbc.DB2jDriver"); to load the driver, it executed correctly.
Then When I try to connect to "jdbc:cloudscape:xxx;create=true";
or just "jdbc:cloudscape:xxx"
I get
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:559)
at java.sql.DriverManager.getConnection(DriverManager.java:211)
what's wrong?
thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jonathan,
I think the prefix for cloudscape is db2j. Try:
 
jonathan Greens
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeane,
thanks! that helps.
I have run into another problem when I try to execute the query against cloudscape. This query works fine in other databases like access but fails here. what's wrong? It seems like the ',' is causing some trouble.

CREATE TABLE Users(lastName varchar,firstName varchar,userName varchar,password varchar,email varchar,gender varchar,adminPriv varchar,securityQuestion varchar,securityAnswer varchar,bDayYear varchar,bDayMonth varchar,bDayDate varchar,title varchar,organization varchar,address1 varchar,address2 varchar,city varchar,state varchar,zip varchar,email2 varchar,enabled varchar)
ERROR 42X01: Syntax error: Encountered "," at line 1, column 41.
at db2j.dl.b.newException(Unknown Source)
at db2j.aa.e.parseStatement(Unknown Source)
at db2j.br.c._ly(Unknown Source)
at db2j.br.c.prepare(Unknown Source)
at db2j.bq.f.prepareInternalStatement(Unknown Source)
at db2j.ai.p.<init>(Unknown Source)
at db2j.ax.e.<init>(Unknown Source)
at db2j.aw.b.<init>(Unknown Source)
at com.ibm.db2j.jdbc.EmbeddedDriver30.newLocalPreparedStatement(Unknown Source)
at db2j.ai.c._xs(Unknown Source)
at db2j.ai.c.prepareStatement(Unknown Source)
at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:185)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:278)
at com.titan.software.atbm.db.ConnectionManager.execUpdate(ConnectionManager.java:202)
at com.titan.software.atbm.db.ConnectionManager.createSchema(ConnectionManager.java:140)
at com.titan.software.atbm.db.ConnectionManager.main(ConnectionManager.java:54)
 
jonathan Greens
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the problem, it seems like I need to specify the length n for varchar, i don't have to do this for ms access.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jonathan,
Thanks for sharing the solution (with the comma) and glad to hear it is working.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic