Archive for Database

a single file to rule them all

Adminer is a single php file  and a great database manager. It supports MySQL, PostgreSQL, SQLite, MS SQL and Oracle databases. It supports Arabic, Catalan, Chinese, Czech, Dutch, English, Estonian, French, German, Hungarian, Italian, Japanese, Portuguese, Russian, Slovak, Slovenian, Spanish, Tamil, Turkish languages. Only 318kb. with all translations included.

Features;

  • Connect to a database server with username and password
  • Select an existing database or create a new one
  • List fields, indexes, foreign keys and triggers of table
  • Change name, engine, collation, auto_increment and comment of table
  • Alter name, type, collation, comment and default values of columns
  • Add and drop tables and columns
  • Create, alter, drop and search by indexes including fulltext
  • Create, alter, drop and link lists by foreign keys
  • Create, alter, drop and select from views
  • Create, alter, drop and call stored procedures and functions
  • Create, alter and drop triggers
  • List data in tables with search, aggregate, sort and limit results
  • Insert new records, update and delete the existing ones
  • Supports all data types, blobs through file transfer
  • Execute any SQL command from a text field or a file
  • Export table structure, data, views, routines, databases to SQL or CSV
  • Print database schema connected by foreign keys
  • Show processes and kill them
  • Display users and rights and change them
  • Display variables with links to documentation
  • Manage events and table partitions (MySQL 5.1)
  • Schemas, sequences, user types (PostgreSQL)

 

Adminer database manager

 

Adminer Home Page

Leave a comment »

SQLJ

Veritabanı işlemleri için SqlJ güzel bir araç. Kısaca

Bağlantı (Oracle)

Oracle.connect(
“jdbc:oracle:thin:@(description=(address=(host=localhost)” +
“(protocol=tcp)(port=1521))(connect_data=(sid=ORCL)))”,
“kullanici”,
“sifre”
);

Tek kayıt sorgulama

int id = 0;
String adi = null;
String soyadi = null;
#sql {
select id, adi, soyadi into : OUT id, : OUT adi, : OUT soyadi from musteriler where rownum = 1;
};
System.out.println(“ID:” + id);
System.out.println(“ADI:” + adi);
System.out.println(“SOYADI:” + soyadi);

Birden çok kaydı tersten sıralama

#sql iterator musterilerITR implements Scrollable
(int id, String adi, String soyadi);
musterilerITR musteriler;
#sql musteriler ={
select id, adi, soyadi from musteriler
};
musteriler.afterLast();
while(musteriler.previous()){
System.out.println(musteriler.id() + “-” + musteriler.adi() + “-” + musteriler.soyadi() + “-”);
}
musteriler.close();


Technorati : ,
Del.icio.us : ,

Leave a comment »

PySQLITE

Python 2.5 ile artık standart paketler arasında yerini aldı. Aşağıdaki örnek bir veritabanı oluşturuyor içine bir tablo açıyor ve bir kayıt ekliyor.

1 conn = sqlite3.connect('/tmp/example')2 c = conn.cursor()3 4 # Tablo oluştur5 c.execute('''create table stocks6 (date timestamp, trans varchar, symbol varchar,7 qty decimal, price decimal)''')8 9 # 1 kayıt ekle10 c.execute("""insert into stocks11 values ('2006-01-05','BUY','RHAT',100,35.14)""")12 

Python sitesinde asla pythonun string operatorleri ile sql stringi hazırlamayın diyor. Şu şekilde örnek vermiş.

1 # Bunu asla yapmayın -- Güvensiz!2 symbol = 'IBM'3 c.execute("... where symbol = '%s'" % symbol)4 5 # Bunu kullanına6 t = (symbol,)7 c.execute('select * from stocks where symbol=?', t)8 9 # Daha büyük örnek olarak:10 for t in (('2006-03-28', 'BUY', 'IBM', 1000, 45.00),11           ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00),12           ('2006-04-06', 'SELL', 'IBM', 500, 53.00),13          ):14     c.execute('insert into stocks values (?,?,?,?,?)', t)15 

Detaylı bilgi için 

Leave a comment »

Switch to our mobile site