Artikel mit Tag sql

myndian.de

Artikel mit Tag sql

Verwandte Tags

oracle database tools view ms sql server java jdbc web development dynamic typing mvc fun optimization antipattern ibatis strindtemplate nice scala velocity performance c# object orientation jsp web-applikationen model driven software development groocy groovy sql maps test spring framework configuration fehlerbehandlung strong typing language framework open source

Mittwoch, 11. Juli 2007

Drop all tables

We tried to deploy an application to a customer’s test system yesterday and needed to clean up the full database. We agreed before that they have to delete the schema and the user with all table etc. but they missed to notify their ORACLE adminstrators. We had only the permissions to work in, but not with the schema. So how to drop a few hundred tables?

DROP TABLE * CASCADE CONSTRAINTS!?

No. No such statement is possible. The solution of my workmate was a little funny:


  1. Open ORACLE SQL Developer and connect to the database / schema.

  2. Mark all tables to delete.

  3. Choose “edit / copy full path” from the applications menu.

  4. Paste the stuff into the script editor. You get something like “TABLE MySchema.MyTable@MyDb”.

  5. Open Search/replace and replace “TABLE MySchema” with “DROP TABLE MySchema”.

  6. Replace also “@MyDb” with “ CASCADE CONSTRAINTS;”.

  7. Run the script. :-)


Geschrieben von Jörg in Softwaretechnik um 07:58 | Kommentare (0) | Trackbacks (0)
Tags für diesen Artikel: database, oracle, sql, tools

Montag, 6. Februar 2006

notice: JDBC batch updates

Lesson for today: Do not update 341443 records at once. :-)
java.sql.BatchUpdateException: I/O Error: Connection reset by peer: socket write error
Better split the update in parts.
Geschrieben von Jörg in Softwaretechnik um 12:38 | Kommentare (0) | Trackbacks (0)
Tags für diesen Artikel: database, java, jdbc, ms sql server, sql

Donnerstag, 2. Februar 2006

weird subselect behaviour

This week we had a very confusing problem with a SQL subselect in a JDBC PreparedStatement for MS SQL Server. I looks like the following:

UPDATE table_a
SET intCol_A = (SELECT intCol_B
FROM table_b
WHERE strCol_B = ?)
WHERE strCol_A = ?


Very simple and easy to understand. It’s works fine until the first question mark was replaced by the null value. Boom!

strCol_B has no null value and should not have one. So logically the subselect should not select anything and return the null value. But it does not. It selected always the same value from strCol_B! (Not intCol_B!) A very weird behaviour. The string was a guid made of capitals and digits, so it could not be casted as an integer, which leads to an error.

How we fixed this? Instead of null we now use a string strCol_B can not contain: $NIL%. The subselect now does not select anything and returns the null value. All fine now.

Weird, isn’t it?
Geschrieben von Jörg in Softwaretechnik um 14:16 | Kommentare (0) | Trackbacks (0)
Tags für diesen Artikel: database, java, jdbc, ms sql server, sql
(Seite 1 von 1, insgesamt 3 Einträge)

Suche

Inhalt

Startseite
Galerien
Impressum

Kategorien

  • XML Alltag
  • XML Internet
  • XML Musik
  • XML Politik
  • XML Reise
  • XML Softwaretechnik
  • XML Sonstiges
  • XML Visuelles

Alle Kategorien

Archive

Februar 2012
Januar 2012
Dezember 2011
Das Neueste ...
Älteres ...

Blog abonnieren

XML RSS 2.0 feed
ATOM/XML ATOM 1.0 feed
XML RSS 2.0 Kommentare

Login

Verwaltung des Blogs

Login

Aktuelle Einträge

Netzwerkkultur verändert die Gesellschaft
Dienstag, 17. November

Absolute and relative date and time
Sonntag, 18. Oktober

Oren Lavie - Her Morning Elegance
Dienstag, 6. Oktober

Twitter & Blogroll
Samstag, 8. August

Read It Later: Round-Trip-Integration mit Firefox und Google-Reader
Montag, 3. August

Blogroll

* Jörg bei Twitter
* Jens bei Twitter
* Nils bei Twitter

* Beetlebum
* a life less ordinary?
* Martin Fowler's Bliki
* Springify
* BILDblog
* Plazeboalarm
* LawBlog
* ADOM Blog
* Being busy
* Dr. Gero Presser

Links

* Heise
* The Scala Programming Language
Nils' Fotos bei fotocommunity.de
Jogi auf Qype
Get Firefox!
Use OpenOffice.org

Heise News

* Auch Tschechien setzt ACTA-Ratifizierung aus

* Datenschutz-Zertifikat für De-Mail-Lösung von Mentana-Claimsoft

* Brüssel will schärfer gegen Copyrightverstöße im Web vorgehen

* Corning und Samsung wollen gemeinsam OLEDs fertigen

* Cloudyn bietet Dienst zur Überwachung der Kosten in der Cloud

kostenloser Counter