RE: DriverManager.getConnection error with JDK 7
Hello, I find my problem. All the issue resume to simple sentence. I think JDK 7 embedded in its classpath the Derby driver class. It's more confuse because in a path OS installation java jdk7 there is a directory db with bin and lib Derby. It's packed with jdk but not really integrated. The manual reference, Derby developer guide and get started not speak to this mean very well. Thank for your help I can use finally Derby 8-) -Message d'origine- De : Bryan Pendleton [mailto:bpendleton.de...@gmail.com] Envoyé : samedi 23 février 2013 18:06 À : Derby Discussion Objet : Re: DriverManager.getConnection error with JDK 7 >> I caught SQLException and he said that : "No suitable driver found >> for jdbc:derby:MoneyBack1;create=true;user=miltone;password=password" > > So your classloader can't find the derby driver. Have you checked that derby.jar is on your classpath? The sysinfo tool is useful for diagnosing classpath problems like these: http://db.apache.org/derby/docs/10.9/getstart/tgsrunningsysinfo.html thanks, bryan
RE: DriverManager.getConnection error with JDK 7
Hello Katherine Marsden, I haven't the java org.apache.derby.tools.sysinfo in my jdk 7 directory and classpath. It's very strange because I can create and manage Derby with jdk7 (directory db in installation path) but there is no class in my classpath for run directly ? When I am in my IDE -Message d'origine- De : Katherine Marsden [mailto:kmarsdende...@sbcglobal.net] Envoyé : dimanche 24 février 2013 15:30 À : Derby Discussion Objet : Re: DriverManager.getConnection error with JDK 7 On 2/24/2013 6:19 AM, john miltone wrote: > I don't find where is my problem with this information sysinfo tool derby : > > Microsoft Windows [version 6.1.7601] > Copyright (c) 2009 Microsoft Corporation. Tous droits réservés. > > C:\Program Files (x86)\Java\jdk1.7.0_10\db\lib>java -jar derbyrun.jar > sysinfo Since you want to test your classpath just use that instead of using -jar derbyrun.jar , so try java org.apache.derby.tools.sysinfo and echo %CLASSPATH% Then hopefully the problem with your classpath will become apparent.
RE: DriverManager.getConnection error with JDK 7
And sysinfo -cp : C:\Program Files (x86)\Java\jdk1.7.0_10\db\lib>java -jar derbyrun.jar sysinfo -cp TROUVE DANS LE CHEMIN DE CLASSES : BibliothÞque de moteur intÚgrÚ Derby (derby.jar) file:/C:/Program Files (x86)/Java/jdk1.7.0_10/db/lib/derby.jar BibliothÞque de moteur intÚgrÚ Derby (derby.jar) file:/C:/Program Files (x86)/Java/jdk1.7.0_10/db/lib/derby.jar BibliothÞque Derby Network Server (derbynet.jar) file:/C:/Program Files (x86)/Java/jdk1.7.0_10/db/lib/derbynet.jar BibliothÞques Derby Client (derbyclient.jar) file:/C:/Program Files (x86)/Java/jdk1.7.0_10/db/lib/derbyclient.jar BibliothÞque d'outils Derby (derbytools.jar) file:/C:/Program Files (x86)/Java/jdk1.7.0_10/db/lib/derbytools.jar REUSSITE : Toutes les classes associÚes Ó Derby ont ÚtÚ trouvÚes dans le chemin de classes. (in English it say GOOD : all the associated class Derby it find in classpath.)
RE: DriverManager.getConnection error with JDK 7
I don't find where is my problem with this information sysinfo tool derby : Microsoft Windows [version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Tous droits réservés. C:\Program Files (x86)\Java\jdk1.7.0_10\db\lib>java -jar derbyrun.jar sysinfo -- Informations Java -- Version Java :1.7.0_13 Fournisseur Java : Oracle Corporation RÚpertoire principal Java : C:\Program Files (x86)\Java\jre7 Chemin de classes Java : derbyrun.jar Nom du systÞme d'exploitation : Windows 7 Architecture du systÞme d'exploitation : x86 Version du systÞme d'exploitation : 6.1 Nom d'utilisateur Java : ymersion RÚpertoire principal utilisateur Java : C:\Users\ymersion RÚpertoire utilisateur Java : C:\Program Files (x86)\Java\jdk1.7.0_10\db\lib java.specification.name: Java Platform API Specification java.specification.version: 1.7 java.runtime.version: 1.7.0_13-b20 - Informations Derby JRE - JDBC: Java SE 7 - JDBC 4.0 [C:\Program Files (x86)\Java\jdk1.7.0_10\db\lib\derby.jar] 10.8.2.2 - (1181258) [C:\Program Files (x86)\Java\jdk1.7.0_10\db\lib\derbytools.jar] 10.8.2.2 - (1181 258) [C:\Program Files (x86)\Java\jdk1.7.0_10\db\lib\derbynet.jar] 10.8.2.2 - (118125 8) [C:\Program Files (x86)\Java\jdk1.7.0_10\db\lib\derbyclient.jar] 10.8.2.2 - (118 1258) -- - Informations sur l'environnement local - Environnement local actuel : [franþais/France [fr_FR]] La prise en charge de cet environnement local a ÚtÚ trouvÚe : [cs] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [de_DE] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [es] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [fr] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [hu] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [it] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [ja_JP] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [ko_KR] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [pl] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [pt_BR] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [ru] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [zh_CN] version : 10.8.2.2 - (1181258) La prise en charge de cet environnement local a ÚtÚ trouvÚe : [zh_TW] version : 10.8.2.2 - (1181258) -- C:\Program Files (x86)\Java\jdk1.7.0_10\db\lib> -Message d'origine- De : Bryan Pendleton [mailto:bpendleton.de...@gmail.com] Envoyé : samedi 23 février 2013 18:06 À : Derby Discussion Objet : Re: DriverManager.getConnection error with JDK 7 >> I caught SQLException and he said that : "No suitable driver found >> for jdbc:derby:MoneyBack1;create=true;user=miltone;password=password" > > So your classloader can't find the derby driver. Have you checked that derby.jar is on your classpath? The sysinfo tool is useful for diagnosing classpath problems like these: http://db.apache.org/derby/docs/10.9/getstart/tgsrunningsysinfo.html thanks, bryan
RE: DriverManager.getConnection error with JDK 7
Hi John English and thank you for help. I caught SQLException and he said that : "No suitable driver found for jdbc:derby:MoneyBack1;create=true;user=miltone;password=password" I have corrected the comma in my string for create table in Derby but this error coming back. However I created database in Derby with ij tool with this command :"connect 'jdbc:derby:MoneyBack1;create=true'; I have inserted value in table and try access those value with select statement. All is good in derby ij. My derby path is in jdk 7 db directory. In my code I tested lot with different connection string but always the same error hereabove. Like as : - String connectionURL = "jdbc:derby:" + dbName + ";create=true;user=" + user + ";password=" + password ; - String connectionURL2 = "jdbc:derby:" + dbName + ";create=true;user=" + user; - String connectionURL3 = "jdbc:derby:" + dbName + ";user=" + user; - String connectionURL4 = "jdbc:derby:" + dbName; -Message d'origine- De : John English [mailto:john.fore...@gmail.com] Envoyé : samedi 23 février 2013 14:50 À : derby-user@db.apache.org Objet : Re: DriverManager.getConnection error with JDK 7 On 23/02/2013 13:21, john miltone wrote: > String connectionURL = "jdbc:derby:" + dbName + > ";create=true;user=" + user + ";password=" + password ; > Connection connexion = > DriverManager.getConnection(connectionURL); Oops, replied too hastily... didn't notice this: > DriverManager.getConnection throw a exeception always. Difficult to say unless you provide details of the error message for the exception. Does the connectionURL work if you connect with IJ? Is the dbname a relative or absolute directory name? If it's relative, are you in the correct current directory when you try and connect? HTH, -- John English
DriverManager.getConnection error with JDK 7
Hi All, I am starting into Derby and I develop on Intellij IDEA with JDK 7. I just want to create and start database. It seems very simple but the first and unique code row generate a exception. Can you help me to understand and arrive to start engine Derby database in my program please ? Here this is my code : " public static void main (String[] args) throws IOException { String dbName = "MoneyBack1"; String user = "miltone"; String password = "password"; String connectionURL = "jdbc:derby:" + dbName + ";create=true;user=" + user + ";password=" + password ; String createString = "CREATE TABLE operation " + "(operation_ID INT NOT NULL GENERATED ALWAYS AS IDENTITY " + " type VARCHAR(32) NOT NULL) " ; try { Connection connexion = DriverManager.getConnection(connectionURL); Statement statement = connexion.createStatement(); statement.executeQuery(createString); statement.close(); connexion.close(); } catch (Throwable e) { System.out.println("1"); } " DriverManager.getConnection throw a exeception always. I'm using JDK 1.7.0_10 so then I don't use ClassName methods for bring driver into memory. Thank a lot for all helping.