Archive for the ‘database’ Category
Reading from CLOB in java through JDBC
Here is a code snippet that I have used to read from a CLOB, Oracle 10g instance.
PreparedStatment ps = connection.prepareStatement
("SELECT clobcolumn from clobtable");
ResultSet rs = ps.executeQuery();
while(rs.next())
{
oracle.sql.CLOB clobValue = (oracle.sql.CLOB)rs.getCLOB(1);
BufferedReader reader = new BufferedReader(new
InputStreamReader(clobValue.getAsciiStream()));
String read = null;
StringBuffer buffer = new StringBuffer();
while((read = reader.readLine()) != null )
{
buffer.append(read);
}
}
Installing Eclipse SQL Explorer Plug-in in Eclipse Ganymede (Eclipse 3.4)
This is an updated post for my earlier post Installing Eclipse SQL Explorer Plug-in for installing Eclipse SQL Explorer plug-in in Eclipse 3.4
Eclipse version 3.4
Eclipse SQL Explorer version 3.5.0
Installing using the Eclipse update manager.
- From the Eclipse menu select Help->Software Updates…
- Software Updates and Add-ons dialogue box will be displayed. Select the Available Software tab on the top of the dialogue box. Now Click on the Add Site button on the right hand side of the dialogue box.
- You will be presented with the Add Site dialogue box. Now in the location add “http://eclipsesql.sourceforge.net/” (without quotes) and click ok to close the dialogue box.
- Select the features you want to install . In this case select the branch, it will also install the patch and click on the Install button on the top right hand side.
- It will check for dependencies if any and will present to you what all you need to install.
Technorati Tags: eclipse, plug-in, sql explorer plug-in
Configuring SQL Explorer Plugin
We will configure the SQL Explorer Plug-in & connect to the database. I will be using MySql server. It will be almost the same for all the databases. If you have not yet installed the plug-in please see my post on Installing Eclipse SQL Explorer Plug-in.
- From the eclipse menu, select window->preferences
- In the preference dialog box, select the SQL Explorer node.
- Select the JDBC Drivers node.
- Select the Driver you want to configure. We will configure MySQL Driver. So select the MySQL Driver & click edit on the right hand side.
- Select the “extra class path” tab in the change dialog box.
- Add the MySQL Connector jar file by clicking on add button. You can download the connectors from MySQL site. You can download it directly from here.
- Once you added the jar file click on List Drivers on the right hand side. You can see all the loaded drivers. Select the one appropriate to you.
- Enter the URL of your MySQL Server in the Example URL text box. Something like this “jdbc:mysql://localhost:3306/test”. Here “test” is the database name & enter the url without quotes.
- Click ok to finish the installation of the driver. You should be able to see a green tick mark for the driver we just installed.
Now we will connect to the database.
- From the eclipse menu, select window->Open Perspective->other.
- In the Open Perspective dialog box select SQL Explorer & click ok.
- Eclipse will be switched to SQL Explorer perspective.
Installing Eclipse SQL Explorer Plug-in
For installing SQL Explorer plug-in in eclipse 3.4 go to this updated post Installing Eclipse Explorer Plug-in in Eclipse Ganymede (Eclipse 3.4).
Today I am going to show you how to install SQL Explorer plug-in in eclipse.
There are two ways to install.
- Download the distribution
file and unzip it into your Eclipse installation. - Use the Eclipse Update
Manager.
Installing using the Eclipse Update Manager
- From the Eclipse menu,
select Help->Software Update->Find and Install. You will be
displayed with a Install/Update dialog box. - Select Search for new
features to install radio button & click next. - Click on the New Remote
Site on the right hand side of the Install dialog box - Enter the name as “SQL
Explorer” & “http://eclipsesql.sourceforge.net/” (without quotes) for
the url in the New Update Site dialog box and click ok. - Select the SQL Explorer
site in the Install dialog box and click finish. - Once the search is
finished, it will present with the features to install. - Select the features you
want to install. In this case select SQL Explorer branch & click next. - Accept the license
agreement & click next. - Select the install location
where you want to install this plug-in. By default it will be installed
into the eclipse plug-in directory. If you want to add another location
click on the change location button on the lower right hand corner and
specify the directory where you want to install. Once you are finished
with the selections click on finish button.








