On 11/11/05, Susan Cline <[EMAIL PROTECTED]> wrote: > I'm not sure I can help, but I'm wondering if there is another way to do > what you are trying to accomplish. It sounds like you can only use the > jdbc:derby:classpath protocol to connect to a database if it *is* contained > in a jar file.
The manual specifically says that it dosn't have to be in a jar: "In most cases, you access databases from the file system as described above. However, it is also possible to access databases from the classpath. The databases can be archived into a jar or zip file or left as is." (http://db.apache.org/derby/docs/10.1/devguide/cdevdvlp91854.html) > You mentioned: > > Database access is configured in Spring to use the DriverManagerDataSource. > > Can you send me that configuration please? This is a standard Spring DriverManagerDataSource configuration: <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"><value>${jdbc.driverClassName}</value></property> <property name="url"><value>${jdbc.runtime.url}</value></property> <property name="username"><value>${jdbc.username}</value></property> <property name="password"><value>${jdbc.password}</value></property> </bean> with the jdbc. properties defined like this: jdbc.driverClassName=org.apache.derby.jdbc.EmbeddedDriver jdbc.username=app jdbc.password= jdbc.runtime.url=jdbc:derby:classpath:derbydb > Also, from the web application can you show how you are connecting to the > database? > Is your first attempt to access Derby in the web app via a JSP or via a Java > class? I simply use the data source that I get from Spring, like with getConnection. Nothing fancy. Also no database access from a JSP (that's evil right ?). Also, database access works when ij was run on the database before the webapp accesses it. > Can you send the code for this as well? > > Also, have you tried putting the database in a jar file and using the > 'classpath' protocol to see if it does work this way? Nope, because that isn't really an option for me as I want to be able to change data in the database, and databases-in-a-jar are read-only. The problem is that I cannot really use a "directory" database url because then I would have to hardcode the path where the webapp gets deployed, into the configuration which of course is not good. And giving a relative path is also nto possible as I don't know what the 'current directory' is when the webapp starts - this depends on the used webserver, and how the webserver was started. Tom
