Jdbc derby driver
i installed the java application server and i want to connect to the derby database.
the only problem is that i can't .i used the instructions from the derby site to set up the database.
http://db.apache.org/derby/papers/DerbyTut/install_software.html
i have to enter each time those commands, because if i restart my computer and i come back and i try to use java org.apache.derby.tools.sysinfo i get class not found error.
anyway after i set up that, and the network server it still doesn't work.
i get the following error:
java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
I also tried using org.apache.derby.jdbc.ClientDriver (found this somewhere in the apache documentation) but still no success.
i tried with and without the Class.forName() method, i have jdk 1.6 installed so theoretically i shouldn't use that. then i get "couldn't find jdbc driver"
also i am using netbeans and i wanted to connect to the database with nebeans but i get an error. database not found if i put jdbc:derby:databasename
and couldn't find driver if i put jdbd:derby
i wanted then to use ms sql server but i got even in more trouble as i have sp2, and no matter what i do i still get "couldn't create socket" (or something like that.
the class path i listed is the system classpath or at least that's what it should be.
if i try echo classpath in the command line i don't get anything. i don't understand why, i did the settings for this for about 1000 times, it all works fine after i finish (classpath and de the derby.tool comand) but still my program doesn't work even imediately afer i redone the settings.
and then, if i close the window and try to use the same commands i used before it's like i never done the settings.
i tried today one more time to connect with netbeans, i didn't change anything, and now i can acces the database. it shows the jdbc drivers
for derby just fine at databases in derby. but as i said in an actual program i still get couldn't find a driver or class not found.
someone told me to add jdbc to netbeans, i don't know exactly how to do that but i already have the jdbc drivers for derby (or at least that's what it shows)
Similar Messages
-
Hi I m new to java database connectivity part.
I have written one program to connect with Derby database but whenever i execute the program i get following error:
What could be the problem
C:\Documents and Settings\milindk\Desktop>java TestDB
java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/
fmgdb;user=fmguser;password=fmguser
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at TestDB.runTest(TestDB.java:28)
at TestDB.main(TestDB.java:12)Source Code is as below
import java.sql.*;
import java.io.*;
import java.util.*;
class TestDB
public static void main(String args[])
try
runTest();
catch (SQLException ex)
for (Throwable t : ex)
t.printStackTrace();
catch (IOException ex)
ex.printStackTrace();
public static void runTest() throws SQLException, IOException
Connection conn=DriverManager.getConnection("jdbc:derby://localhost:1527/fmgdb;user=fmguser;password=fmguser");
try
Statement stat = conn.createStatement();
stat.executeUpdate("CREATE TABLE Greetings (Message CHAR(20))");
stat.executeUpdate("INSERT INTO Greetings VALUES ('Hello, World!')");
ResultSet result = stat.executeQuery("SELECT * FROM Greetings");
if (result.next())
System.out.println(result.getString(1));
result.close();
stat.executeUpdate("DROP TABLE Greetings");
finally
conn.close();
}I have modified my souce code accordingly
but still i m getting following error.
C:\>java TestDB
java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at TestDB.runTest(TestDB.java:33)
at TestDB.main(TestDB.java:12)Source Code
import java.sql.*;
import java.io.*;
import java.util.*;
class TestDB
public static void main(String args[])
try
runTest();
catch (SQLException ex)
for (Throwable t : ex)
t.printStackTrace();
catch (IOException ex)
ex.printStackTrace();
catch (ClassNotFoundException ex)
ex.printStackTrace();
public static void runTest() throws SQLException, IOException,ClassNotFoundException
//Connection conn = getConnection();
Class.forName("org.apache.derby.jdbc.ClientDriver");
Connection conn=DriverManager.getConnection("jdbc:derby://localhost:1527/fmgdb;user=fmguser;password=fmguser");
try
Statement stat = conn.createStatement();
System.out.println("Creating a table");
stat.executeUpdate("CREATE TABLE Greetings (Message CHAR(20))");
stat.executeUpdate("INSERT INTO Greetings VALUES ('Hello, World!')");
ResultSet result = stat.executeQuery("SELECT * FROM Greetings");
if (result.next())
System.out.println(result.getString(1));
result.close();
stat.executeUpdate("DROP TABLE Greetings");
finally
conn.close();
/*public static Connection getConnection() throws SQLException, IOException
Properties props = new Properties();
FileInputStream in = new FileInputStream("database.properties");
props.load(in);
in.close();
String drivers = props.getProperty("jdbc.drivers");
if (drivers != null) System.setProperty("jdbc.drivers", drivers);
String url = props.getProperty("jdbc.url");
String username = props.getProperty("jdbc.username");
String password = props.getProperty("jdbc.password");
return DriverManager.getConnection(url, username, password);
} -
Hi having a problem connecting to Derby from Netbeans 6.5, running Ubuntu.
I get the error message: "An error occurred while creating the database: The Java DB (Network) driver was not found".
It starts up fine, but I can't create a database.
Under: Services > Drivers, there is Java DB (Embedded) which exists at: usr/share/javadb/lib/derby.jar.
Is the Derby driver different from the Java DB Network driver? Or is there some magical incantation I am supposed to put upon Netbeans to make this all work? I have a chicken here and I am willing to sacrifice it to the Derby God to get this working.I have the same problem. I'm new dealing with ubuntu and netbeans. I have netbeans 6.5 installed from synaptic. After this, I have installed all and every plugin from inside the netbeans plugins menu.
I have written, compiled and run c and c++ small apps, and java console and windowed small apps too.
I find 2 main errors:
1.- When I try to create a database from netbeans/Services/Databases/Java DB and clicking with the secondary mouse button and choosing "Create Database" from the context menu.
If the database name I want to create is db1, as an example, the program creates some directories and files in $HOME/.netbeans-derby/db1
But finish with the error message:
"An error occurred while creating the database: The Java DB (Network) driver was not found"
I can open this database and create tables in it, from the context menus of netbeans/Services/Databases/Drivers over
jdbc:derby:$HOME/.netbeans-derby/db1 nbuser on APP
But I wonder if the database is correctly created or not. I'd like to activate the Java DB (Network) driver but I don't know how to do it.
I have installed the glassfishv2 package from synaptic but I think it wasn't necesary because I think the javadb database was running well before this.
2.- I don't know if this second problem has something to do or has some common or relationed points with the first one, but I'm going to tell you it, too.
When I try to create a new java desktop application, when I must choose the Application Shell, I only can choose Basic Application. The Database Application Shell (as described in netbeans and derby manuals) is not present at all.
I wonder why the database application shell is missing and how can I configure netbeans for showing the Database Application Shell option.
Thanks a lot -
CR4E 1.0 - need help to setup derby driver
Hello!
Im trying to follow Getting Started Guide and on the page 11 I see "Go to Database Explorer". CR4E doesn't have this view.
I go to the "Window -> Preferences ->Connectivity - Driver Definitions" and add a record for Derby Driver 10.1 (Derby Embedded JDBC Driver), as mentioned in Guide, add two jars as driver files (derby.jar and Xtreme.jar from <CR4E folder>\plugins\com.businessobjects.crystalreports.samples_1.0.4.v1094\SampleDatabases), set connecton URL as "jdbc:derby:classpath:/Xtreme;create=true", DB name as "classpath:/Xtreme" and user id set as "bobj".
After that in "Data Source Explorer" I've created a new record for Database with type "Derby Embedded Database". Ping test was successful. But after connection I don't see any schemas. And in Eclipse dir file "dreby.log" has been created with following record:
2009-03-05 09:20:28.250 GMT:
Booting Derby version The Apache Software Foundation - Apache Derby - 10.1.1.0 - (208786): instance c013800d-011f-d5ef-102b-000002537450
on database directory classpath:/Xtreme
Database Class Loader started - derby.database.classpath=''
How to setup derby driver properly? Can anybody help me? Is there anybody who successful followed this Guide?
Help will be appriciated.
Regards, LevHey Lev,
I have not done much with Derby so cant help on that side, but for the Data Source Explorer issue, if you go Window >> Show View >> you should be able to get to the DS Explorer that way (From the CR perspective)
Hope that helps abit.
Does the "Sample Reports" not already come with Derby connections setup, maybe look at their
settings. But as I said I have not played around with this type of connection, sorry.
Darren -
JDBC/OCI driver for JDK1.2
Hi,
I have an evaluation copy of Oracle8 version 8.0.3.0 and
downloaded the JDBC/OCI driver for JDK1.1 (classe111.zip). The
example I used was also taken from this site, which connects to
the database and lists ename from emp, using scott/tiger.
Everything worked fine under JDK1.1 but I can't get the code to
work with JDK 1.2
Does Oracle provide a JDBC/OCI driver that will work with JAVA
1.2 or am I missing something. Please note that I am not using
Oracle8i.
Any assistance would be greatly appreciated.
Karim
nullKarim,
Openlink Software (http://www.openlinksw.com) provides JDBC 2.0
drivers in version 3.2. This version will be hitting our public
web site next week, but you can get pre-release components from
ftp://ftp.openlinksw.com/pre-3.2/index.html
The JDK 1.2 drivers are all the way at the bottom under the
Windows section.
HTH,
Stephen
Karim (guest) wrote:
: Hi,
: I have an evaluation copy of Oracle8 version 8.0.3.0 and
: downloaded the JDBC/OCI driver for JDK1.1 (classe111.zip). The
: example I used was also taken from this site, which connects
to
: the database and lists ename from emp, using scott/tiger.
: Everything worked fine under JDK1.1 but I can't get the code
to
: work with JDK 1.2
: Does Oracle provide a JDBC/OCI driver that will work with JAVA
: 1.2 or am I missing something. Please note that I am not using
: Oracle8i.
: Any assistance would be greatly appreciated.
: Karim
null -
I'm using IBM's WebSphere JDBC connection pool to manage oracle
connections. While the code worked normally on Sun Solaris, I
get ORA-03123, ORA-03127 etc errors on AIX. I'm closing the
resultsets, the statement handles and releasing the connection
after each SQL execution. Is this an AIX JDBC OCI driver problem
or am I missing something.
Thanks,
Ravi
nullI found problem like you but on DIGITAL UNIX 4.0D It's an
AIO Consistency Error.. did you know some thing about this??
and For your question OCI7 driver to connect to ORACLE7.3.4 are
in liboci73.so or another extension depend on your OS (I don't
know what's one on AIX) but it must come with Oracle
Installation Package you can install on AIX :>
Prashant (guest) wrote:
: Hi:
: Does any one know where I could find JDBC/OCI level 2 driver
: for AIX (4.2) running Oracle (7.3.4). All I have been able to
: locate is the NT and Solaris. Both contains classes and shared
: libraries for that machine. I saw someone posted this question
: before, however, suggestions was to use dynamic library
generated
: for Solaris, this will not work. Does anyone have other
: suggestions.
: Any and all help is appreciated.
: Many Thanks
: Prashant.
null -
Is there free jdbc type4 driver for oracle?
i neen to connect to oracle to develop my application, but there's a problem when tryin' to resolve peoblem of character set. in oracle, as i know, it uses unicode that resulting in the font code, which is not falling into the character set of unicode, whould cause failure in translating user defined font code. beside, for i do not know what kind of license that oracle jdbc type4 driver publishes, hope someone are able to tell me wheather there's any software like freetds in sql2000, because, if necessary, i may need to redistrubite the jdbc driver for my own use!
thanks in advice,Oracle has drivers available from their site (free ones) for java and the specific version of Oracle you are running.
-
I have downloaded oracle 8.1.6.0 jdbc thin driver(named classes12.zip) to run with jdk1.3 to access oracle 8.0.5, but when I compile and run the jdbccheckup.java downloaded from oracle website like this:
javac -classpath d:\jdbc\classes12.zip jdbccheckup.java
(compile succeed)
java -classpath d:\jdbc\classes12.zip jdbccheckup
an error occured:
Exception in thread "main" java.lang.NoClassDefFoundError:jdbccheckup
Why??????Try this isntead.
java -classpath d:\jdbc\classes12.zip;. jdbccheckup
an error occured:
Exception in thread "main" java.lang.NoClassDefFoundError:jdbccheckup
Why?????? -
Bug in Oracle JDBC thin driver (parameter order)
[ I'd preferably send this to some Oracle support email but I
can't find any on both www.oracle.com and www.technet.com. ]
The following program illustrates bug I found in JDBC Oracle thin
driver.
* Synopsis:
The parameters of prepared statement (I tested SELECT's and
UPDATE's) are bound in the reverse order.
If one do:
PreparedStatement p = connection.prepareStatement(
"SELECT field FROM table WHERE first = ? and second = ?");
and then bind parameter 1 to "a" and parameter to "b":
p.setString(1, "a");
p.setString(2, "b");
then executing p yields the same results as executing
SELECT field FROM table WHERE first = "b" and second = "a"
although it should be equivalent to
SELECT field FROM table WHERE first = "a" and second = "b"
The bug is present only in "thin" Oracle JDBC driver. Changing
driver to "oci8" solves the problem.
* Version and platform info:
I detected the bug using Oracle 8.0.5 server for Linux.
According to $ORACLE_HOME/jdbc/README.doc that is
Oracle JDBC Drivers release 8.0.5.0.0 (Production Release)
* The program below:
The program below illustrates the bug by creating dummy two
column table, inserting the row into it and then selecting
the contents using prepared statement. Those operations
are performed on both good (oci8) and bad (thin) connections,
the results can be compared.
You may need to change SID, listener port and account data
in getConnecton calls.
Sample program output:
$ javac ShowBug.java; java ShowBug
Output for both connections should be the same
--------------- thin Driver ---------------
[ Non parametrized query: ]
aaa
[ The same - parametrized (should give one row): ]
[ The same - with buggy reversed order (should give no answers):
aaa
--------------- oci8 driver ---------------
[ Non parametrized query: ]
aaa
[ The same - parametrized (should give one row): ]
aaa
[ The same - with buggy reversed order (should give no answers):
--------------- The end ---------------
* The program itself
import java.sql.*;
class ShowBug
public static void main (String args [])
throws SQLException
// Load the Oracle JDBC driver
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
System.out.println("Output for both connections should be the
same");
Connection buggyConnection
= DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:ORACLE",
"scott", "tiger");
process("thin Driver", buggyConnection);
Connection goodConnection
= DriverManager.getConnection ("jdbc:oracle:oci8:",
"scott", "tiger");
process("oci8 driver", goodConnection);
System.out.println("--------------- The end ---------------");
public static void process(String title, Connection conn)
throws SQLException
System.out.println("--------------- " + title + "
Statement stmt = conn.createStatement ();
stmt.execute(
"CREATE TABLE bug (id VARCHAR(10), val VARCHAR(10))");
stmt.executeUpdate(
"INSERT INTO bug VALUES('aaa', 'bbb')");
System.out.println("[ Non parametrized query: ]");
ResultSet rset = stmt.executeQuery(
"select id from bug where id = 'aaa' and val = 'bbb'");
while (rset.next ())
System.out.println (rset.getString (1));
System.out.println("[ The same - parametrized (should give one
row): ]");
PreparedStatement prep = conn.prepareStatement(
"select id from bug where id = ? and val = ?");
prep.setString(1, "aaa");
prep.setString(2, "bbb");
rset = prep.executeQuery();
while (rset.next ())
System.out.println (rset.getString (1));
System.out.println("[ The same - with buggy reversed order
(should give no answers): ]");
prep = conn.prepareStatement(
"select id from bug where id = ? and val = ?");
prep.setString(1, "bbb");
prep.setString(2, "aaa");
rset = prep.executeQuery();
while (rset.next ())
System.out.println (rset.getString (1));
stmt.execute("DROP TABLE bug");
nullHorea
In the ejb-jar.xml, in the method a cursor is closed, set <trans-attribute>
to "Never".
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name></ejb-name>
<method-name></method-name>
</method>
<trans-attribute>Never</trans-attribute>
</container-transaction>
</assembly-descriptor>
Deepak
Horea Raducan wrote:
Is there a known bug in Oracle JDBC thin driver version 8.1.6 that would
prevent it from closing the open cursors ?
Thank you,
Horea -
Bug in Oracle JDBC thin driver 8.1.6 ?
Is there a known bug in Oracle JDBC thin driver version 8.1.6 that would
prevent it from closing the open cursors ?
Thank you,
HoreaHorea
In the ejb-jar.xml, in the method a cursor is closed, set <trans-attribute>
to "Never".
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name></ejb-name>
<method-name></method-name>
</method>
<trans-attribute>Never</trans-attribute>
</container-transaction>
</assembly-descriptor>
Deepak
Horea Raducan wrote:
Is there a known bug in Oracle JDBC thin driver version 8.1.6 that would
prevent it from closing the open cursors ?
Thank you,
Horea -
Error Code Definition for JDBC Thin driver
Would like to know where I can find the definition of error codes
for JDBC thin driver to Oracle 7 database. Right now, when I have
database errors, I get SQL execption with CODE=XXXXXX. Need to
know the definition of the error codes in order to decide whether
the application shall retry or quit or do something else. Thank
you in advance.
nullHi,
thin client session Language is controlled by java Locale.
Based on testing code, ORA- messages are localized after the connection is successfully established. ORA- messages returned in the middle of connecting are in instance language.
So, as far as I can say, you need to catch exceptions from DriverManager.getConnection(url, info); and translate them on your own.
Once the connection is successfully returned, ORA- message language is defined by java Locale.
Tests were performed on Oracle 10gR2 (both thin driver and DB). -
Jdbc oracle jdbc-thin driver subname
I am working on Windows 2000 environment, using oracle8i 8.1.7 JDBC-Thin driver for use with JDK 1.2.x. The oralce8i 8.1.7 database is on another linux box. I can access the linux box through its ip address, but not by its hostname since it's not accessiable by the dns server. In my code, in the JDBCUrl, I used ip address instead of the hostname, e.g. "jdbc:oracle:thin:@10.0.113.108:1521:ora1". But I got the error like: "java.sql.SQLException: Io exception: The Network Adapter could not establish the connection". If I add a entry in my working machine's hosts file to map the hostname, I can fix the problem. But I don't know if this is the solution, or there is other better solutions.
Thanks
nullUsing a hosts file entry is a common solution for problem where the dns lookup does not contain an entry for a RDBMS server platform.
The real solution is to resolve this issue :
"where the dns lookup does not contain an entry for a RDBMS server platform." -
Oracle Jdbc Thin driver and nls suppot
Hello,
I have a hungarian database with nls_lang variable set to hungarian. I'm trying to do a jdbc connection using classes12.zip
but I'm getting the hungarian characters converted to question marks or other characters.
I read suggestions that I must include the nls_charset12.zip in my classpath too. So I did that but I'm still having the same problem.
What is missed??
How do I get the right hungarian charachters without any conversion.
This is becoming frustrating and I'm not able to solve it yet.
Thanks for your helpOne more question -
Can we use Oracle JDBC OCI driver? We do not have any appletes...
Does it have firewall issues too? Is there any other driver that
we can use?
Thanks,
Vijaya. -
Oracle JDBC thin driver question
Does anyone know if there is a JDBC thin driver available for Oracle that supports "HTTP tunneling" of the SQLNET wire protocol?
Such a driver would package the SQL*NET data stream into HTTP or HTTPS packets and connects to a Servlet proxy on the Web host that unpacks the data and forwards the SQL*NET stream to the Oracle RDBMS and returns the response the same way.
This would help me overcome some firewall issues I'm seeing since HTTP/HTTPS ports are usually opened through a firewall. I know Sybase has a JDBC dirver that does this for their TNS protocol and was hoping some company has developed this for Oracle.
Thanks in advance...The easiest thing to do is download it as an archive with your applet.
Otherwise, you have to have the files on every client machine.
For netscape, put the classes111.jar in the java classes folder typically:
c:\ProgramFiles\Netscape\Communicator\Program\java\classes.
I'd expect that IE would be setup in a similar way. -
Oracle JDBC Thin Driver for oracle 9.2.0.4
Hi,
It would be nice if someone please guide me to the download of Oracle JDBC Thin Driver for oracle 9.2.0.4.
Thanks in anticipationuser566773,
As far as I know, all Oracle JDBC drivers are meant to be backward compatible.
According to the table on the following Web page, the latest Oracle JDBC driver can be used with Oracle 9.2.0.x DBMS.
http://www.oracle.com/technology/tech/java/sqlj_jdbc/index.html
Good Luck,
Avi.
Maybe you are looking for
-
Windows 8.1 Pro Pack fails to install
Been trying to install Windows 8.1 Pro Pack on my Dell XPS but it continues to fail, indicating 'something went wrong'. I worked with two different Microsoft support techs on this. The first executed a number of scans and started dism.exe /online /
-
Sharpening in Lightroom and/or Photoshop
It appears to me that I can obtain all necessary sharpening, including improved midtone contrast (normally obtained with the High Pass Filter in Photoshop) using the tools available in Lightroom 2.4. I am considering the following Lightroom only work
-
Finding user details,messages present and total space consumed
Hi, i have to find - the total number of users present in the ims server, - the total number of messages present - the total amount of disk space consumed by all messages. when iam executing the command "mboxutil -a" on solaris iam getting all the us
-
404: ora92054.exe
I can't download the Oracle ODBC Drivers for Oracle 9.2.0 version 9.2.0.5.4 because the download link is not working http://download.oracle.com/otn/utilities_drivers/odbc/oracle9i/ora92054.exe
-
Flash Video won't show in IE or Netscape (PC Versions)
Neither browser may have the plug-in - I haven't checked BUT - shouldn't it prompt me for the plugin? I checked that box in Dreamweaver to have it do so. Anyway - In IE I get nothing while in Netscape I get the audio that is in the file - just no vid