Ekrem Altintas

Greenhorn
+ Follow
since Dec 20, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ekrem Altintas

Hello I want to update records on DB.I wrote this statements but when I execute the program, records on the sayi column become 0.Is UPDATE satement wrong?



I wrote this code. If deger[0] equal to kelime I want to increase the value of sayi.But if block didn't work.What should I do?
I created a resultset object.I want to know if record(s) exist or not.Do you know a method for it?
I have to fetch data from MySQL database.I'm using this statement.



I used sonuc in the code below but compiler is giving error.

[CODE]if (sonuc==0)
{
cumle.executeUpdate("INSERT INTO kelimeler(kelime,sayi) VALUES('"+deger[0]+"',1)");
}[CODE]

I have to use sonuc as integer.Is there method for it?
I forgot the other value.

String[] deger = new String[50];
Connection conn = null;
try
{
...
cumle = conn.createStatement();
...
cumle.excuteUpdate("INSERT INTO kelimeler(kelime,sayi) VALUES('"+deger[0]+"',1)");
...
}

I wrote this statement, I'm taking;

cannot resolve symbol
symbol : method executeUpdate (java.lang.String)
location: interface java.sql.Statement

error.I don't know what is the problem.
Thanks for your help.I solved the problem.
18 years ago
The code is executing the while-loop once and I can not see result of this statement: System.out.println(satir);



import java.io.*;
import java.net.*;
import java.lang.*;
import java.sql.*;
import java.util.regex.*;
import java.util.*;

public class Derlemeproblem{

public static void main(String args[]) throws IOException
{
URL local = new URL("http://localhost/phpmyadmin/hey.html");
URLConnection baglanti = local.openConnection();


BufferedReader oku = new BufferedReader(new InputStreamReader(baglanti.getInputStream()));


try
{

String satir;
int u,boy;
char[] kelime = new char[2500];
boolean kucuk=false;
u=0;

while ((satir = oku.readLine()) != null)
{

u=satir.length();

boy=0;

if(u!=0&u!=-1)
{
while(boy<u)
{
kar=satir.charAt(boy);

if(kar=='<')
{
kucuk=true;

}

else if(kar=='>')
{
kucuk=false;

}

if(kucuk==false)
{
if (satir.charAt(boy+1)!='<')
{
kelime[boy]=satir.charAt(boy+1);
System.out.println("YAZ "+kelime[boy]);
}
else
{
kucuk=true;
boy=boy+1;
kelime[boy]=' ';
System.out.println("YAZ "+kelime[boy]);
}

}
boy=boy+1;
}

}
System.out.println(satir);
}

}
catch(Exception e)
{
// System.err.println ("Cannot connect to database server");
}

}
}
18 years ago
char kar;
String satir;
int b;
char kar;
...
kar=satir.charAt(b);
if(kar=="<")
{
...
}

I'm writing a code, but I'm taking " operator == cannot be applied to char,java.lang.String - if(kar=">") " error.How can I resolve this problem?
18 years ago
I want to record a variable to database(MySQL).Connection established.

I have tried several kinds of syntax, but it didn't work.How is the "insert" syntax?

String abc='hello';
cumle.executeUpdate("INSERT INTO genel(id, "+"Url) VALUES(5,abc)");
I'm trying to find http links in a web page.I am writing a code for it.I'm searching line by line but if the web page code, has more than one http link, my code finds only one link.What should I do?
This is my code;

import java.net.*;
import java.lang.*;
import java.util.regex.*;
import java.util.*;

public class Linkler2{

public static void main(String args[]) throws IOException
{
String sayi;
int abc;

URL local = new URL("http://www.google.com.tr");
URLConnection baglanti = local.openConnection();

BufferedReader oku = new BufferedReader(new InputStreamReader(baglanti.getInputStream()));
PrintWriter dataOut = new PrintWriter(new FileWriter("abc2.txt"),true);

try
{

int deger=0;

int kelime=0;

while ((sayi = oku.readLine()) != null)
{
System.out.println(sayi);
kelime= sayi.indexOf("http://");
System.out.println(kelime);
if (kelime!=-1)
{
deger=deger+1;
}

dataOut.println(sayi);

}

System.out.println(deger);
}
18 years ago
hellohowareyouhellohowareyou

For example, I want to find "hello" words in the text above. There is not spaces in this text.What can I do?
18 years ago
I'm want to find a word in a text file which clas and method is suitable for this purpose?
18 years ago