Posts

Showing posts with the label database

Why @Transactional not working in my code?

Image
Clash Royale CLAN TAG #URR8PPP Why @Transactional not working in my code? @Service public class SingleCityService implements ICityService { private static final Logger logger = LoggerFactory.getLogger(SingleCityService.class); @Autowired CityMmtRepo cityMmtRepo; @Autowired MmtCityService mmtCityService; @Autowired RestCityService restCityService; @PostConstruct public void init() { CityServiceFactory.getInstance().registor(EnumCity.SINGLE_CITY, this); } /** * Method to validate if action type is to Create city or Update city * * @param request * @return CityServiceResponse */ @Override public CityServiceResponse serveRequest(CityServiceRequest request) throws ResourceException, InvalidCityCreateException, SQLException { ValidatorFactory.getInstance().getRequestValidator(Validator.SINGLE_CITY_VALIDATOR).validate(request); if (CityActionType.CREATE.toString().equals(request.getEventType().getActionType())) { return createCity(request); } return updateCity...

Connect of android app is timeout with localhost

Image
Clash Royale CLAN TAG #URR8PPP Connect of android app is timeout with localhost I have a localhost and when I try to get data from it from my android app it give me this error: (This site can't be reached 192.168.1.105 took too long to respond ERR_CONNECTION_TIMED_OUT ) can anyone help me ??? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Why SQL query takes too long time to execute when fetching bulk data (without space)?

Image
Clash Royale CLAN TAG #URR8PPP Why SQL query takes too long time to execute when fetching bulk data (without space)? I have a problem, when getting bulk amount of data from a table. I have a database table TblJobs , in this table some columns contain bulk amount of data (approx 60,000 characters in this column). TblJobs My table: TblJobs JobId JobTitle JobDescription ---------------------------------------------------------------- 1 Job1 TextTextTextTextTextTextTextTextTextTextTextText... (approx 40,000 characters without any space in job description) 2 Job2 HelloHelloHelloHelloHelloHelloHelloHelloHelloHell..(approx 60,000 characters without any space in job description) 3 Job3 DemoDemoDemoDemoDemoDemoDemoDemoDemoDemoDemoDemo...(approx 60,000 characters without any space in job description) 4 Job4 TestingTestingTestingTestingTestingTestingTesti....(approx 50,000 characters without any space in job description) Str...

Login form in mysql

Image
Clash Royale CLAN TAG #URR8PPP Login form in mysql I am using Mysql netbeans . I have created a db table "userdetails_summertrainingproject" . In the login form I have two fileds to fill one is "UUId_JTextField" and other is "Password1_JPasswordField". I want to compare that the password value entered by the user is same as that in db for the particular UUId entered by the user. UUid is unique. try{ Class.forName("com.mysql.jdbc.Driver"); Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","root",""); String query = "SELECT password FROM userdetails_summertrainingproject WHERE UUId=?;"; PreparedStatement preparedStatement = conn.prepareStatement(query); preparedStatement.setString(1,UUId_JTextField.getText()); ResultSet rs = preparedStatement.executeQuery(); ...

How can write this query in sql?

Image
Clash Royale CLAN TAG #URR8PPP How can write this query in sql? Tables: TEAMS( tid , tname, tcolor, budget) PLAYERS( pid , pname, age, country) PLAYS( pid , tid , season, value) -(pid references to pid in PLAYERS table) -(tid references to tid in TEAMS table) WINS( wtid , ltid , season, wscore, lscore) -(wtid (winner) and ltid (loser) references to tid in TEAMS table) I have to write query for this:(I tried with "not exist" and "not in" but could not do it.) Find tid of teams that played with all teams. 1) please show what you tried, even if it didn't work. Then we know you did try. 2) Please explain the structure of your database. 3) You've shown us some fields but not explained what the output of the query should be (i.e what the rules are, what should / should not be included, and what the criteria for that are). Ideally show us some example source data and example of what they query output would be based on that source data....

Location of my.cnf file on macOS

Image
Clash Royale CLAN TAG #URR8PPP Location of my.cnf file on macOS I'm trying to follow along this tutorial to enable remote access to MySQL. The problem is, where should my.cnf file be located? I'm using Mac OS X Lion. my.cnf I think this belongs to serverfault.com. But still, welcome to SO! – Artefact2 May 25 '12 at 15:28 21 Answers 21 This thread on the MySQL forum says: By default, the OS X installation does not use a my.cnf, and MySQL just uses the default values. To set up your own my.cnf, you could just create a file straight in /etc. OS X provides example configuration files at /usr/local/mysql/support-files/ . /usr/local/mysql/support-files/ And if you can't find them there, MySQ...

where can i write in the code to avoid duplicate byyer registration using database using jsp . i mean no multiple entries in database with same name

Image
Clash Royale CLAN TAG #URR8PPP where can i write in the code to avoid duplicate byyer registration using database using jsp . i mean no multiple entries in database with same name <% String date="NO"; String uname= request.getParameter("uname"); String fname= request.getParameter("fname"); String lname= request.getParameter("lname"); String password= request.getParameter("pass"); String email= request.getParameter("email"); String phoneno=request.getParameter("phoneno"); String photo=request.getParameter("photo"); try { ResultSet rs=null; int id=0; int i=0; String str="USR00"; Connection con=databasecon.getconnection(); Statement st=con.createStatement(); String qry="select max(id) from user"; rs=st.executeQuery(qry); if(rs.next()) { i=rs.getInt(1); i++; uid=str+i; System.out.println(uid); } //sConnection con=databasecon.getconnection(); Prepar...

how to use textfield input in mysql SELECT query

Image
Clash Royale CLAN TAG #URR8PPP how to use textfield input in mysql SELECT query I am using java netbeans and mysql. I want to check whether the value entered by the user in a textfield tf is already present in the mysql tabel or not. String query1="SELECT * FROM trytable WHERE name='8'"; ResultSet rs=stmt.executeQuery(query1); if(rs.isBeforeFirst()==true){JOptionPane.showMessageDialog(null,"already");} In the above code in place of 8 i want to give the value that the user input in the form and then check whether that value already exist in form or not. Please help me in the first line . Thanks So you have two issues: How to declare a variable in Java netbeans, and how to query a database? For the second point, what if someone inserts '8' while you're in the middle of checking? – Strawberry 51 mins ago ...

SQLAlchemy calling function won't insert

Image
Clash Royale CLAN TAG #URR8PPP SQLAlchemy calling function won't insert so I am very confused about this weird behaviour I have with SQLAlchemy and PostgreSQL. Let's say I have a table: create table staging.my_table( id integer DEFAULT nextval(bla bla bla.., name text, ; and a stored function: create or replace function staging.test() returns void language plpgsql as $function$ begin insert into staging.my_table (name) values ('yay insert'); end; $function$; What I want to do now is call this function in python with sqlalchemy like this: from sqlalchemy import create_engine engine = create_engine('postgresql+psycopg2://foo:bar@localhost:5432/baz') engine.execute('select staging.test()') When I run this python code nothing get's inserted in my database. That's weird because when I replace the function call with select 1 and add .fetchall() to it it get's executed and I see the result in console when I print it. select 1 .fetc...

Excel VBA not retrieving data as before [on hold]

Image
Clash Royale CLAN TAG #URR8PPP Excel VBA not retrieving data as before [on hold] I want to pull data from website "http://result.biselahore.com/" to Excel Sheet by entering roll number "217449". After entering Roll Number it goes to the result card page with detail subject wise marks. To get subject-wise marks from the next page and paste it on excel, the following code is not working and it gives error number 91, "Object variable With block variable not set". Here is my entire code: Sub WData() Do Until ActiveCell.Value = "100000" Dim IE As New InternetExplorer Dim DOCS As HTMLDocument Dim str, str1, str2, str3, str4, str5 As String IE.navigate "http://result.biselahore.com/" IE.Visible = True Do DoEvents Loop Until IE.readyState = READYSTATE_COMPLETE IE.document.getElementById("rollNum").Value = ActiveCell.Value IE.document.forms(0).submit Do While IE.Busy DoEvents Loop Set DOCS = IE.document Do While DOCS.readyState <...

Two user one ticket

Image
Clash Royale CLAN TAG #URR8PPP Two user one ticket Recently on the interview I received a question: "What would happen when two different users will try to book the same ticket at the same millisecond?" Anyone knows the answer? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

SQL database manipulation - How do I append the parent name to the child name in this database example

Image
Clash Royale CLAN TAG #URR8PPP SQL database manipulation - How do I append the parent name to the child name in this database example I have an SQL database, I have access via phpmyadmin I have parent and child data in the same table, I want to append the parent name to the end of the child name. This is what I currently have Image of current table data This is what I would like to create Image of how I would like table data to look I need help writing a script to achieve this that I can use in phpmyadmin. The database has 4000 products in it, if that makes any difference. I will only need to run this once. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

How relation between one record on a table and several records on onother table

Image
Clash Royale CLAN TAG #URR8PPP How relation between one record on a table and several records on onother table My project is a program like movie collection. Main table is for storing movie data with fields like name,director,release year and ... But each record must have another attribute named genre (genres). Each movie may be categorized by one or several genres (Comedy, Horror, History, Romance,...) Genre table contain two fields.ID:integer and Genre:vchar For each movie, some of genre fields can be selected. How I can do this? thank you you have to use sql join for that, but before this you have to set relationship of primary key table and foreign key table – ershoaib 7 mins ago sql join Possible duplicate of How to implement one-to-one, one-to-many and many-to-many relationships while designing tables? Yo...

How can update the MySQL Connector/J on DataGrip

Image
Clash Royale CLAN TAG #URR8PPP How can update the MySQL Connector/J on DataGrip My DataGrip showed only MySQL Connector/J ver.5.1.46 as latest, how can I update it in MySQL 8.0.11? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

nothing showed up after click a link(from database) in php

nothing showed up after click a link(from database) in php I have a database called simple_stall with table order_detail which have 4 columns ID Name Ordered_Item Quantity ...currently after user submit their order, they'll be redirected to a page called order_detail.php ...this page will show all ordered item in table with header ID Name Ordered_Item Quantity simple_stall order_detail ID Name Ordered_Item Quantity order_detail.php ID Name Ordered_Item Quantity now, when user click on someone's name from the table, i want to redirect user to a new page called view_more.php which will show the item ordered by the user however, nothing showed in the page. view_more.php This is my code: index.php index.php <div class="container"> <form action="insert_data.php" method="POST"> <div> <input type="text" name="Name" placeholder="Name"> </div> <di...